Posted by member 5575 on 2004-08-28 01:24:12
Ever want to try loading or unloading modules from your file manager - assuming you have some reason to do that, of course? Just place shortcuts to the necessary scripts (or batch files, if you're a rabidcow) in your "Send To" folder, and you can. You can place the scripts wherever you'd like, as long as the shortcuts point to them, and name the shortcuts however you'd like - I use DLL_reload and DLL_unload. The following script does module reloading - just make a second copy and change "!Reloadmodule" to "!Unloadmodule" and it'll do the unloading. (Duh.) The script could be much shorter if you skip error and sanity checking, of course.
'-----
' Set the following variable to the name of the executable you wish to
' use to execute bang commands, e.g., litestep.exe, bang.exe. The
' executeable must be:
' 1) Fully qualified, e.g., C:\liteStep\tools\bang.exe, or
' 2) In your path (I think that'll do it).
'-----
LoadCommand = ""
BangExe = "C:\Shells\LiteStep\litestep.exe"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set wShell = CreateObject("WScript.Shell")
'--- See if a DLL file has been selected by dragging it onto the script, or
'--- onto a shortcut to the script.
If (WScript.Arguments.Count = 0) Then
msgstr = "You didn't feed me a DLL!"
dummy = wShell.Popup(msgstr,3,"Error!",64)
WScript.Quit
ElseIf (WScript.Arguments.Count = 1) Then
DLLPath = WScript.Arguments.Item(0)
If (FSO.FileExists(DLLPath)) Then
If (LCase(Right(DLLPath,3)) "dll") Then
msgstr = "That was *NOT* a DLL!"
dummy = wShell.Popup(msgstr,3,"Error!",64)
WScript.Quit
End If
'--- Construct bang command sequence
LoadCommand = "!ReloadModule "&DLLPath
End If
End If
Set FSO = Nothing
'--- Execute the bang? Uncomment lines to prompt first.
If (Len(LoadCommand) > 0) Then
' msgstr = "LoadModule command is:"&vblf&vblf&_
' LoadCommand&vblf&vblf&"Continue?"
' If (MsgBox(msgstr,1) = 1) Then
Retval = wShell.Run(BangExe & " " & LoadCommand,0,true)
' End If
Else
msgstr = "Original text was:"&vblf&sClipText&vblf&vblf&_
"Load Command is:"&vblf&LoadCommand&vblf&vblf&_
"Bang executable is:"&vblf&BangExe
dummy = wShell.Popup(msgstr,5,"Error extracting parameters:",64)
End If
Set wShell = Nothing
'--- That'll do
WScript.Quit
' Set the following variable to the name of the executable you wish to
' use to execute bang commands, e.g., litestep.exe, bang.exe. The
' executeable must be:
' 1) Fully qualified, e.g., C:\liteStep\tools\bang.exe, or
' 2) In your path (I think that'll do it).
'-----
LoadCommand = ""
BangExe = "C:\Shells\LiteStep\litestep.exe"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set wShell = CreateObject("WScript.Shell")
'--- See if a DLL file has been selected by dragging it onto the script, or
'--- onto a shortcut to the script.
If (WScript.Arguments.Count = 0) Then
msgstr = "You didn't feed me a DLL!"
dummy = wShell.Popup(msgstr,3,"Error!",64)
WScript.Quit
ElseIf (WScript.Arguments.Count = 1) Then
DLLPath = WScript.Arguments.Item(0)
If (FSO.FileExists(DLLPath)) Then
If (LCase(Right(DLLPath,3)) "dll") Then
msgstr = "That was *NOT* a DLL!"
dummy = wShell.Popup(msgstr,3,"Error!",64)
WScript.Quit
End If
'--- Construct bang command sequence
LoadCommand = "!ReloadModule "&DLLPath
End If
End If
Set FSO = Nothing
'--- Execute the bang? Uncomment lines to prompt first.
If (Len(LoadCommand) > 0) Then
' msgstr = "LoadModule command is:"&vblf&vblf&_
' LoadCommand&vblf&vblf&"Continue?"
' If (MsgBox(msgstr,1) = 1) Then
Retval = wShell.Run(BangExe & " " & LoadCommand,0,true)
' End If
Else
msgstr = "Original text was:"&vblf&sClipText&vblf&vblf&_
"Load Command is:"&vblf&LoadCommand&vblf&vblf&_
"Bang executable is:"&vblf&BangExe
dummy = wShell.Popup(msgstr,5,"Error extracting parameters:",64)
End If
Set wShell = Nothing
'--- That'll do
WScript.Quit