The renewal maintenance has officially ended for Progress iMacros effective November 30, 2023.
This Wiki site will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely, The Progress Team
Timeout Tutorial
The different timeouts in iMacros
Timeout as macro variable
There are three different timeout macro variables in iMacros:
- !TIMEOUT_MACRO
- Infinity by default. By setting it you limit the total time the complete macro is going to run before it is aborted with error code = -1930, and the following message: "A timeout of x seconds set by !TIMEOUT_MACRO variable has exceeded."
- This variable does not have any dependency with the other timeout variables.
- !TIMEOUT_PAGE
- It governs the maximum time iMacros waits for a single page to load, before stopping with error = -1330 and message "A timeout of x seconds set by !TIMEOUT_PAGE variable has exceeded."
- !TIMEOUT is the same as !TIMEOUT_PAGE.
- !TIMEOUT_STEP, also !TIMEOUT_TAG
- It controls how long (at most) iMacros tries to find an element (html, or image) on the page. If no value is given, iMacros uses 1/10 of !TIMEOUT_PAGE, although changing !TIMEOUT_STEP won't affect !TIMEOUT_PAGE.
- When playing a TAG, IMAGESEARCH, or IMAGECLICK command, iMacros looks for the element on the page once and waits what we call a "load check interval" (currently 1 second). Then it looks for the element again, and again, and as many times until it is found or !TIMEOUT_STEP is reached. In other words, !TIMEOUT_STEP is the number of times iMacros is going to retry the command (only TAG and IMAGESEARCH/CLICK). Setting !TIMEOUT_STEP to 0 (zero) leads iMacros to run the command only once, and setting !TIMEOUT_STEP to 10, for instance, will cause iMacros to process the subsequent TAG and IMAGESEARCH commands up to 11 times, if the element is not found before. That is, it waits for it 10 seconds at most.
- When the element is not found within !TIMEOUT_STEP, iMacros stops with error = -1300 (or -1800 in case of Imagesearch), unless !ERRORIGNORE was set to YES.
Timeout as Scripting Interface method parameter
There is also the timeout that can be set in some Scripting Interface methods calls: iimOpen, iimPlay, iimPlayCode, iimExit, iimDisplay. This timeout is the time the scripting interface waits for a response from the browser that is being automated, and has no correlation with the three iMacros timeout variables. In particular, the timeout set in iimPlay can be easily confused with !TIMEOUT_MACRO, but while setting iimPlay's timeout to a lower value than necessary to run successfully the macro in question will cause iimPlay to return a timeout error (-3, in this case), the browser will keep playing the macro until its end or will stop because it has lost the connection with the scripting interface. The latter is logged in iMacros.log. The scripting interface timeout is important to avoid freezing the calling script or program in case the browser becomes unresponsive.
Notes
- The variable !WAITPAGECOMPLETE has no effect on any of the timeout variables. Setting !WAITPAGECOMPLETE to YES or NO changes when iMacros assumes that the page is fully loaded.
- If your macro contains one or more WAIT commands, the time the macro needs to run is the total time, including all the time it waits forcefully at a WAIT. If you have set !TIMEOUT_MACRO to some finite value this might cause the macro to be aborted before is complete.
- Since !TIMEOUT_STEP is 1/10 of !TIMEOUT_PAGE by default and only integral numbers are accepted, setting !TIMEOUT_PAGE to a value lower than 10 will cause !TIMEOUT_STEP to be 0, unless you have explicitly set it to a different value.