Edoctoor
Edoctoor

Reputation: 181

I want iMacro to continue unless conditional error found else an error message and exit

I want iMacro to continue unless conditional error found else an error message and exit

I have been struggling to find a way to not have to type 'PROMPT {{!VAR1}} and constantly comment and uncomment the PROMPT {{!VAR1}} every time there was a issue in my poorly coded scripts.

Using iim, javascript within the iMacro EVAL() statement

Upvotes: -1

Views: 1136

Answers (1)

Edoctoor
Edoctoor

Reputation: 181

Using the iMacros EVAL() this code will not stop the script unless an error condition is found.. lets say if the value of !EXTRACT is 0 for example.

'initialize variables
SET !ERRORIGNORE        YES
SET !EXTRACT_TEST_POPUP NO

' your code

' Depending on !EXTRACT 1 or 0 a error message occurs 
' (If error.. macros displays a message and stops.. else macro continues)
' iMacros error message
SET !EXTRACT 1
SET !ERRORIGNORE        NO
SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; var d=parseFloat(s); if(!d){MacroError(\"EXTRACT FALSE = 0 Error message\");} else d;")
SET !ERRORIGNORE        YES
PAUSE
' iMacros error message 
SET !EXTRACT 0
SET !ERRORIGNORE        NO
SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; var d=parseFloat(s); if(!d){MacroError(\"EXTRACT FALSE = 0 Error message\");} else d;")
SET !ERRORIGNORE        YES
PAUSE

Upvotes: 2

Related Questions