Sign in to follow this  
Followers 0
schnibble

iOpus iMacros

1 post in this topic

is it possible to scripting from autoit to iMacros directly? Not with batch scripting. It suport windows scripting host too, but how can i use this scripting commands in autoit?

CODE
Available scripting commands:

Note: All functions return a value > 0 if they succeed, and an error code < 0 in case of problems. You can use iimGetLastError to retrieve the text associated with the last error. A list of return codes is available here.

The optional timeout value determins when the Scripting Interface returns a timeout error if the command does not complete the command in time. The default value for most commands is 3 seconds, except for the iimPlay command. The iimPlay command as a default timeout of 600 seconds (10 minutes).

--------------------------------------------------------------------------------

iimDisplay ("Hello", optional: <timeout>)

This message is displayed in the iMacros browser. A typical usage would be to distinguish several running IIM browsers or display information on the current position within the script. If you want to hide the display so that you can manually trigger macros with the PLAY button please use iimDisplay ("#HIDEDISPLAY")

--------------------------------------------------------------------------------

iimExit(optional: <timeout>)

Close the iMacros browser. It first attempts to close the browser by sending it a direct message. If the browser does not react (e.g. because the website made the browser freeze), it terminates the browser. Thus the Scripting Engine will keep control even if the browser itself is "frozen". After iimExit(), you can start a new IIM Browser with "set iim1= CreateObject ("InternetMacros.iim")" and "i= iim1.iimInit"

--------------------------------------------------------------------------------

iimGetLastError()

Returns the text associated with the last error.

--------------------------------------------------------------------------------

iimGetLastExtract()

If the last command was iimPlay and if EXTRACT is used inside a macro iimGetLastExtract returns the extracted text. If the EXTRACT command can not find the extraction anchor, an "Extraction anchor not found (#EANF#)" message is returned. See iimPlay for more Details.

--------------------------------------------------------------------------------

iimInit()

Initializes the scripting interface. In most cases, no parameters are required.

Advanced settings:iimInit (<command line>, <start browser>, <run as user>, <run as password>, <run as domain>)

Note 1: Use iimInit ("-ie") to start Internet Explorer (IE) instead of the iMacros browser.

Note 2: Use iimInit ("-ie", FALSE) or iimInit ("", FALSE) to connect to an existing instance of Internet Explorer (IE) or IIM browser. If in this case the Interface will not automatically open a new instance of IE or IIM browser, but look if it can find an open and idle instance. If none is found, a new instance is created.

A typical use for this feature is if you manually log into a website and then start the script/macro to do some work on the currently active web page. With this setting iimInit looks for an already open instance of the iMacros browser and connects to it. It also connects to open instances of Internet Explorer that have the iMacros Plugin switched on (visible).

Note 3: Use iimInit ("-tray") to start iMacros in tray mode. Or use iimInit ("-silent") to run it without tray icon.

Note 4: You can call iimInit from a Windows Service.

Note 5: If you use the "Run As" feature of the iimInit command, you must use the "SetRunAs" utility to store the user name and password of the "Run As user" in the registry. The tool can be found in the iMacros Program directory (typically c:\Program Files\iMacros\ ). Experts can also change the settings manually using the "dcomcnfg" utility from Microsoft, but the use of the provided tool is recommended. If you do not make this required setting, iimInit will notify you by returning a "-5" error code.

--------------------------------------------------------------------------------

iimPlay ("mymacro", optional: <timeout>)

Play the macro! After the macro has played all options that have been set with the iimSet command are reset.

Specific return values:

1: Macro completed without problems.

Use iimGetLastExtract to get extracted text. If there is no extracted text ( no EXTRACT command in the macro) iimGetLastExtract returns "" (nothing). If there is a EXTRACT command but the extraction fails then the string returned by iimGetLastExtract contains the #EANF# tag.

<0: Error encountered, use iimGetLastError to get the error message. A list of return codes is available here.

Special case:If you start the macro via iimPlay and it contains a " TAG TYPE=SELECT ..." statement and select a value that is NOT in the list, then selecting the iimPlay command returns an error code that is the maximum number of lines possible. You can use this value, for example, to always select the last entry of a changing selection list.

You can also send the macro code directly to the IIM browser:

iimPlay ("CODE:URL GOTO ...", optional: <timeout>)

The lines in the macro can be separated the the CR symbol. This is vbNewLine or vbCrLf in Visual Basic or "\r\n" in C, C++ or C# languages. For an example, see the "send-macro-code.vbs" example script.

--------------------------------------------------------------------------------

iimSet ("-xx", "value")

Store values and settings that are used when iMacros is started. You can use exactly the same commands as for the command line interface. After iimPlay all settings are erased.

Example:

iimSet("-var1", "Tom") => Fills the variable{{!VAR1}} with Tom

iimSet("-var_ZIP", "44051") => Creates & fills the variable{{ZIP}} with "44051"

iimSet("-tray", "") => Activates the TRAY mode

--------------------------------------------------------------------------------

CODE
Windows Scripting Host Example:

(To run this example, copy this text in a file with the ending ".vbs", e.g. "test.vbs").

set iim1= CreateObject ("InternetMacros.iim")

i = iim1.iimInit

i = iim1.iimSet("-var1", "Tom Tester")

i = iim1.iimSet("-tray", "")

i = iim1.iimDisplay("This is a test")

i = iim1.iimPlay("myfirstmacro")

If i > 0 Then

s = "Everything OK)

Else

s = iim1.iimGetLastError()

End If

MsgBox s

i = iim1.iimExit

thanks alot

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0