Macro Scheduler

From iMacros
Jump to: navigation, search

Macro Scheduler allows you to embed VBScript code between VBSTART / VBEND tokens. You can then run VBScript subroutines with VBRun and evaluate VBScript expressions with VBEval. So, for example, see the script file below. This runs the iMacros file and gets the extracted data and then outputs it to Notepad. You will see it uses VBEval so that it can get the extracted data returned from the VBScript function back into the calling code. So this way Macro Scheduler has access to the VBScript data.

So if you are using Macro Scheduler to push the data to another application, youcan do it this way. For more complex processes you might have the VBScript get different parts of data and populate an array, which they could then walk through in Macro Scheduler code perhaps. You can envisage a number of solutions.


Macro Scheduler Code:

 VBSTART
 
 Function RuniMacros(file)
 
    Dim iim1, i, iret
    set iim1 = CreateObject("imacros")
    iret = iim1.iimInit
 
    'Run the macro
    iret = iim1.iimPlay(file)
 
    RuniMacros = iim1.iimGetLastExtract()
    iret = iim1.iimExit
 End Function
 
 VBEND
 
 VBEval>RuniMacros("%SCRIPT_DIR%\mjtnet.iim"),res
 //output data in a messagebox
 //MessageModal>res
 
 //output the data to Notepad
 Let>RP_WAIT=2
 Run>Notepad.exe
 WaitWindowOpen>Untitled - Notepad
 SendText>res

iMacros Test Macro:

 URL GOTO=http://www.mjtnet.com/
 TAG POS=2 TYPE=H1 ATTR=TXT:* EXTRACT=TXT