Conditional Back Command

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
a2515125
Posts: 114
Joined: Tue Dec 06, 2016 3:37 am

Conditional Back Command

Post by a2515125 » Thu Aug 30, 2018 4:25 am

FF 50.1/windows 10 / imacros 8.9.7

when my main script extracts data through pages, it would be stuck by "Error displaying this page" after turning several pages

so I make another .iim to run BACK Command whenever my main script detects "Error displaying this page" pop-up again

but the imacros shows :wrong format of SET command, line 13 (Error code: -910) with my eval statement that I

am sure the problem is here {var x='imacros://run/?m=carousell\工具\BACKPAGE1.iim';}


I am very sure that my expression of \工具\BACKPAGE1.iim is wrong
even I rewrite it as var x='imacros://run/?m=carousell\\工具\\BACKPAGE1.iim' in Eval statement , the Prompt debug it as imacros://run/?m=carousell工具BACKPAGE1.iim, two \ disappear!

I would be appreciated if chivracq can help or someone knows how to rewrite my eval statement. Big Thanks!!!





Code: Select all

SET !REPLAYSPEED FAST
SET !EXTRACT_TEST_POPUP NO
SET !ERRORIGNORE YES
SET !TIMEOUT_PAGE 3
SET !TIMEOUT_STEP 0
SET !LOOP -9999
CLEAR 


'call BACKPAGE1.iim, if fails to extract data, move to previous page and extract again
SET !EXTRACT NULL
TAG POS=1 TYPE=H1 ATTR=CLASS:text-center EXTRACT=TXT
SET BACKPAGE EVAL("var s='{{!EXTRACT}}'; if(s=='Error displaying this page') {var x='imacros://run/?m=carousell\工具\BACKPAGE1.iim';} else{var x=' ';} x;")
URL GOTO={{BACKPAGE}}

chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Conditional Back Command

Post by chivracq » Thu Aug 30, 2018 5:10 am

a2515125 wrote:

Code: Select all

FF 50.1/windows 10 / imacros 8.9.7
when my main script extracts data through pages, it would be stuck by "Error displaying this page" after turning several pages

so I make another .iim to run BACK Command whenever my main script detects "Error displaying this page" pop-up again

but the imacros shows :

Code: Select all

wrong format of SET command, line 13 (Error code: -910)
with my eval statement that I

am sure the problem is here {var x='imacros://run/?m=carousell\工具\BACKPAGE1.iim';}

I would be appreciated if chivracq can help or someone knows how to rewrite my eval statement. Big Thanks!!!

Code: Select all

SET !REPLAYSPEED FAST
SET !EXTRACT_TEST_POPUP NO
SET !ERRORIGNORE YES
SET !TIMEOUT_PAGE 3
SET !TIMEOUT_STEP 0
SET !LOOP -9999
CLEAR 

'call BACKPAGE1.iim, if fails to extract data, move to previous page and extract again
SET !EXTRACT NULL
TAG POS=1 TYPE=H1 ATTR=CLASS:text-center EXTRACT=TXT
SET BACKPAGE EVAL("var s='{{!EXTRACT}}'; if(s=='Error displaying this page') {var x='imacros://run/?m=carousell\工具\BACKPAGE1.iim';} else{var x=' ';} x;")
URL GOTO={{BACKPAGE}}
Hum..., I don't know where you find all those unsupported Tricks, I guess I must have posted this one several years ago..., but hum..., using Trick on Trick on Workaround on Trick makes the whole Workflow of your overall Script(s) very cumbersome... It's OK for me because I will always find a Solution/Workaround, but in your case, you could better start considering using a '.js' Script "orchestrating" the complete Workflow of your Scripting from just one main '.js' Script...

Calling an '.iim' Script from an '.iim' Script with that 'imacros://run/?m=' Syntax has sometimes some unpredictable Side-Effects, with Focus and etc..., and you'll need from your 'BACKPAGE1.iim' to call back the first Macro, which will have lost the Count for the Loop and will screw your Modulo[40] "Thing"...
If the Page you need to go back has a "distinct" URL, you could otherwise better conditionally go to that URL with 'URL GOTO' directly rather than calling another Macro...

But OK, the Cause of your current RuntimeError, I suspect, are the Backslashes in your Path that need to be escaped..., or you can try with Forward Slashes, maybe Doubled..., or to declare the Path to that Macro in some apart Var outside the 'EVAL()'. Or place that Macro in your Default 'Macros' Folder, then you don't need to specify its complete Path...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
a2515125
Posts: 114
Joined: Tue Dec 06, 2016 3:37 am

Re: Conditional Back Command

Post by a2515125 » Thu Aug 30, 2018 5:25 am

Forward Slashes Work!!!!! Genius Mr. iMacros!!! :mrgreen: :mrgreen: :mrgreen:
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Conditional Back Command

Post by chivracq » Thu Aug 30, 2018 5:27 am

a2515125 wrote:Forward Slashes Work!!!!! Genius Mr. iMacros!!! :mrgreen: :mrgreen: :mrgreen:
Ah-ah...!! :wink:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Post Reply