iimClose

From iMacros
Jump to: navigation, search

Closes 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) then it terminates the browser. Thus, the Scripting Engine will keep control even if the browser itself is "frozen".

For use with Firefox we suggest to disable the Firefox session recovery feature. This avoids a dialog if iimClose has to terminate Firefox.

Syntax iMacros Browser IE Plug-in Firefox Chrome

int ret_code = iimClose( [int timeout] )

Return values:

  • 1 : OK. Brower closed itself after receiving the command or the browser process was terminated after timeout.
  • -4 : Browser was not started, cannot close.
  • other negative values : iimClose tried to terminate the browser process (because it failed to close itself), but this also failed.

Note: You should call iimClose always, even if iimOpen itself returns an error value and the browser is not started. This way you make sure all is "cleaned up". The cleanup code kills the browser instance (if any) and also makes sure all the variables are reset and references are deleted.

Parameters

  • int timeout
    The optional timeout value determines when the Scripting Interface returns a timeout error if the command is not completed in time. The default value is 10 seconds.

Examples

Visual Basic Script example:

Dim imacros, iret
Set imacros = CreateObject("imacros")
iret = imacros.iimOpen()
iret = imacros.iimPlay("mymacro")
iret = imacros.iimClose()


See Also

iimOpen, iimPlay, iimDisplay, iimGetErrorText, iimGetExtract, iimTakeBrowserScreenshot