Using this code, you can tell your vbs to run your macro from a dynamic location. i.e. the same folder as the vbs, regardless of where iMacros is configured to use. This is especially useful if you move your macros around a lot between different folder structures, or if they're used by many people with slightly different configurations.
Code: Select all
Dim iim1, iret
'initialize iMacros instance
set iim1 = CreateObject ("imacros")
DIM oShell, ofso, wshell
Set oShell = CreateObject("WScript.Shell")
Set ofso = CreateObject("Scripting.FileSystemObject")
oShell.CurrentDirectory = oFSO.GetParentFolderName(Wscript.ScriptFullName)
set wshell = createobject("wscript.shell")
iret = iim1.iimPlay(wshell.currentdirectory&"Your Macro.iim")
iret = iim1.iimPlay(wshell.currentdirectory&"Your Next Macro.iim")
iret = iim1.iimPlay(wshell.currentdirectory&"Your Final Macro.iim")