The renewal maintenance has officially ended for Progress iMacros effective November 30, 2023.
This Wiki site will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely, The Progress Team
send-macro-code.vbs
Instead of having the script call a locally saved macro, it can also "send" macro code directly to an iMacros instance.
Important: Each iimPlay run resets all settings and value from the previous iimPlay run. This means that you should not use one iimPlay per line, but first concatenate all commands and then send them to iMacros via the iimPlay command (as shown in this example). The browser context is preserved between different iimPlay, so one macro can continue where the previous one stopped. Only iMacros internal settings (SET command) are reset between different iimPlay.
Tip: To convert text macros (iim files) into inline code use the iMacros Editor Code Generator feature.
' iMacros Send-Macro-Code Script ' (c) Ipswitch Inc. Option Explicit Dim iim1, iret MsgBox ("This example script uses NO macros, but sends the macro code directly.") set iim1= CreateObject ("imacros") iret = iim1.iimOpen("") Dim MyMacroCode MyMacroCode = "TAB T=1" + vbNewLine MyMacroCode = MyMacroCode+"TAB CLOSEALLOTHERS" + vbNewLine MyMacroCode = MyMacroCode+"URL GOTO=https://www.imacros.net" + vbNewLine MyMacroCode = MyMacroCode+"WAIT SECONDS=3" + vbNewLine MyMacroCode = MyMacroCode+"URL GOTO=https://forum.imacros.net" 'Tip: Use the iMacros Editor Code Generator feature 'to convert your iMacros macros into some scripting/programming language code. iret = iim1.iimDisplay("Start demo") 'Run the first macro iret = iim1.iimPlayCode(MyMacroCode) if iret < 0 Then MsgBox "Macro#1: Error Code: "+cstr(iret) + VbCrLf + "Error Text: "+iim1. iimGetErrorText() End If 'Run the second macro (one line only) iret = iim1.iimPlayCode("URL GOTO=https://wiki.imacros.net") If iret < 0 Then MsgBox "Macro#2: Error Code: "+cstr(iret) + VbCrLf + "Error Text: "+iim1. iimGetErrorText() End If iret = iim1.iimDisplay("Script completed.") MsgBox "Close iMacros browser" iret = iim1.iimClose WScript.Quit(iret)