iimExit()

From iMacros
Jump to: navigation, search

Name change: Please use iimClose instead. See API enhancements for details.

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 iimExit has to terminate Firefox.

Syntax

int ret_code = iimExit ( [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 exit.
  • other negative values : iimExit tried to terminate the browser process (because it failed to close itself), but this also failed.

Note: You should call iimExit always, even if iimInit 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.iimInit()
iret = imacros.iimPlay("mymacro")
iret = imacros.iimExit()


See Also

iimInit, iimPlay, iimDisplay, iimGetLastError, iimGetLastExtract, iimTakeBrowserScreenshot