Solved: Macro stops if HTTP status code != 200

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
Forum rules
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
Chilly_Bang
Posts: 29
Joined: Tue Jan 27, 2015 9:13 am

Solved: Macro stops if HTTP status code != 200

Post by Chilly_Bang » Tue Jan 27, 2015 9:23 am

Hello!

I have a macro, which turns pages one by one and saves files located on the pages. The macro works like expected, if all browsed pages answer with HTTP status code 200, also are available Here is the macro code:

Code: Select all

 VERSION BUILD=8881205 RECORDER=FX
 TAB T=1
 URL GOTO=https://example.com/?page={{!LOOP}}
 TAG POS=1 TYPE=BUTTON ATTR=TXT:
 ONDOWNLOAD FOLDER=* FILE=+_{{!NOW:yyyymmdd_hhnnss}} WAIT=YES
 TAG POS=1 TYPE=A ATTR=TXT:Excel
 TAG POS=1 TYPE=A ATTR=TXT:Next<SP>Page<SP>>
Issue: if any page answers with any code other then 200, the macro stops and if started again, begins the loop from the first page again.
Question: how can i adjust the macro code, that if a page has any other code then 200, then the macro does 5 tryings to reach the page, then, if the code already not 200, skips the unavailable page and goes to the next page.

Thank you and best regards from Berlin!
Last edited by Chilly_Bang on Sun Feb 21, 2016 5:02 pm, edited 1 time in total.
FCI: Win 7 x64 + Win10 x64 + FF 45.9.0 + iMacro for FF 9.0.3
skippyto
Posts: 108
Joined: Wed Aug 20, 2008 8:14 am

Re: Macro stops if HTTP status code != 200

Post by skippyto » Fri Jan 30, 2015 1:48 pm

Hi Chilly_Bang

Try SET !ERRORIGNORE :

Code: Select all

 VERSION BUILD=8881205 RECORDER=FX
 TAB T=1
SET !ERRORIGNORE YES
 URL GOTO=https://example.com/?page={{!LOOP}}
 TAG POS=1 TYPE=BUTTON ATTR=TXT:
 ONDOWNLOAD FOLDER=* FILE=+_{{!NOW:yyyymmdd_hhnnss}} WAIT=YES
 TAG POS=1 TYPE=A ATTR=TXT:Excel
SET !ERRORIGNORE NO
 TAG POS=1 TYPE=A ATTR=TXT:Next<SP>Page<SP>>
Skippyto
chivracq
Posts: 8719
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Macro stops if HTTP status code != 200

Post by chivracq » Fri Jan 30, 2015 7:35 pm

Yep, 'Skippyto''s Answer is good for skipping the Page in case of a problem in order to keep the Macro running, but doesn't tackle the "try 5 times" part to make the Macro "more robust"... (Can be done...)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply