iimInit()
From iMacros
Initializes the Scripting Interface and opens a new instance of the iMacros Browser unless otherwise stated by the command_line parameter. If you use the Run As feature of the iimInit command then you must use the SetRunAs.exe 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 then iimInit will notify you by returning a -5 error code.
A list of return codes is available here [1].
Contents |
Syntax
int ret_code = iimInit( String command_line [, boolean start_browser] [, String run_as_user, String run_as_password, String run_as_domain], Long timeout)
Parameters
- String command_line
- Specifies command line switches. All switches start with a dash (-). Possible switches are:
- -ie Starts Internet Explorer instead of the iMacros Browser.
- -fx Starts Mozilla Firefox instead of the iMacros Browser. (iMacros for Firefox needs to be installed).
- -tray Starts the iMacros Browser in tray mode.
- -silent Starts the iMacros Browser in silent mode, i.e. tray mode without a tray icon.
- -key Start iMacros with the specified license key, for example as Player. This ignores any license key that the user might have entered.
- -runner Starts iMacros via the iimRunner tool.
- boolean start_browser
- Specifies whether to connect to an open instance of the iMacros Browser, Firefox or Internet Explorer. If set to false, iMacros tries to connect to an existing instance. If none is found, a new instance is created. Default is true.
- String run_as_user (Or: Use iimRunner instead)
- Username under whose account the iMacros Broser is started.
- String run_as_password
- Password needed for the account specified in run_as_user.
- String run_as_domain
- Domain in which the username given in run_as_user is valid.
- Long timeout
- iimInit waits <timeout> seconds for the iMacros Browser, Firefox or IE to start. Default is 300 seconds. Note that on systems with a heavy CPU load (near or equal 100%) it can take around 30s for a web browser to start.
Return values
- 1 Completed ok
- -1 Could not start the specified web browser
- -6 (only with -runner flag) iimRunner not running. Please start iimRunner.exe first. You find this file in the iMacros program directory.
- -7 (only with -runner flag) The max. number of allowed iMacros instances is reached. You can change this limit in the simple.xml file. You find this file in the iMacros program directory. This error also occurs if there is no simple.xml file-
Examples
Initialize the Scripting Interface in silent mode (iMacros not visible in taskbar or tray - Visual Basic Script example):
Dim imacros, iret
Set imacros = CreateObject("imacros")
iret = imacros1.iimInit("-silent")
Initialize the Scripting Interface connection to an existing Internet Explorer instance:
Dim imacros, iret
Set imacros = CreateObject("imacros")
iret = imacros1.iimInit("-ie", FALSE)
Start Firefox via iimRunner :
Dim imacros, iret
Set imacros = CreateObject("imacros")
iret = imacros1.iimInit("-fx -runner")
