how refresh page and restart script without check next line?

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

how refresh page and restart script without check next line?

by ibamibrhm on Tue May 01, 2018 11:01 pm

hi,
maybe something like this:

Code: Select all
if (Error) {
   refresh page and restart script without check next line;
} else {
   continue script;
}


I using !ERRORIGNORE but after error found imacros keep continuing until last line, it take a long time.

is it possible to refresh page and restart script without check next line?
ibamibrhm
 
Posts: 2
Joined: Tue May 01, 2018 10:42 pm

Re: how refresh page and restart script without check next l

by chivracq on Wed May 02, 2018 4:31 am

ibamibrhm wrote:hi,
maybe something like this:

Code: Select all
if (Error) {
   refresh page and restart script without check next line;
} else {
   continue script;
}


I using !ERRORIGNORE but after error found imacros keep continuing until last line, it take a long time.

is it possible to refresh page and restart script without check next line?

(F)CIM...! :mrgreen: (Read my Sig...)

But, yep..., you give the Answer yourself..., you need to split your Script into 2 parts indeed where you will loop the first part based on the Return Code with a 'while' Loop for example, for the second part to be executed only once the first part has been "successful"...

It's possible to do in pure '.iim' by looping your whole Script (well, you only have one anyway, ah-ah...!) and checking with some 'EXTRACT' where your Error can occur and making then the '!TIMEOUT_STEP' conditionally to "0" for example if you don't already have it set to "0" before, and if you have any Clicks on Links or Buttons you can toggle all "POS=1" to "POS=0" conditionally, same with 'URL GOTO' to an empty String or maybe combined with '!TIMEOUT_PAGE' set to "1" which is the lowest Value you can use, but you will have to "wait" 1 sec for each of those Lines...
Some "Technique" I use myself as well in one of my ('.iim') Scripts, is to "send" your Script conditionally to some "fake" second Tab where all the Buttons and Links won't exist and therefore won't do anything...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 7055
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: how refresh page and restart script without check next l

by chivracq on Wed May 02, 2018 5:30 am

chivracq wrote:Some "Technique" I use myself as well in one of my ('.iim') Scripts, is to "send" your Script conditionally to some "fake" second Tab where all the Buttons and Links won't exist and therefore won't do anything...

Quoting myself, ah-ah...! :twisted:

Just wanted to add that that "Trick" won't work for 'URL GOTO' Statements, you still need to set them conditionally to an empty String (with 'EVAL()') but it might become a little bit "cumbersome" if you have many of those in the 2nd part of your Script, and that wouldn't work if you use the 'REFRESH' Command. A 'REFRESH' will always be executed (in '.iim'), it cannot be made conditional, you need to use the 'URL GOTO' on the URL itself but that's not always possible on all Sites...
And a 'REFRESH' will always take at least 1 sec (if you've set '!TIMEOUT_PAGE' to the lowest "1" Value), but using this "fake" 2nd Tab Trick could actually become a "usable" Workaround for getting a Conditional 'REFRESH' by actually opening that 2nd Tab on some Local mini-'.TXT' File. A 'REFRESH' on some Local mini-'.TXT' File will only take a few milliseconds, which is much faster than (re)loading any "real" Web-Page from any Site...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 7055
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: how refresh page and restart script without check next l

by ibamibrhm on Wed May 02, 2018 6:39 am

@chivracq thanks for kind response

Code: Select all
imacros version: 10.0.1
chrome version: 66
windows 10 pro v1803


I just use default TIMEOUT_STEP. if I change it some button still loading and it will ruin my script.

this is my script
Code: Select all
URL GOTO=https://www.lazada.co.id/products/asus-zenfone-max-pro-m1-zb602kl-3gb32gb-deepsea-black-i319671794-s325148883.html
TAG SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV:nth-of-type(7)>DIV>DIV>DIV>DIV>A>SPAN>I"
TAG SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV:nth-of-type(7)>DIV>DIV>DIV>DIV>A>SPAN>I"
TAG SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV:nth-of-type(7)>DIV>DIV>DIV>DIV>A>SPAN>I"
TAG SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV:nth-of-type(7)>DIV>DIV>DIV>DIV>A>SPAN>I"
TAG POS=1 TYPE=BUTTON ATTR=TXT:TAMBAH<SP>KE<SP>TROLI
WAIT seconds=0.5
TAG POS=1 TYPE=BUTTON ATTR=TXT:PEMBAYARAN
TAG POS=1 TYPE=BUTTON ATTR=TXT:LANJUTKAN<SP>KE<SP>PEMBAYARAN
WAIT seconds=0.5
TAG POS=3 TYPE=DIV ATTR=TXT:melalui<SP>bank<SP>transfer
TAG POS=1 TYPE=P ATTR=TXT:BCA
TAG POS=1 TYPE=BUTTON ATTR=TXT:BUAT<SP>PESANAN<SP>SEKARANG


well, i want to buy stuff from flash sale and i need script who can always refresh page and buy if that stuff available.

so i need script like this after line 6.
Code: Select all
if (Error or cant buy) {
   refresh page and restart script from line 1 without check next line;
} else {
   continue script and buy;
} end;


do you have simple trick?
your trick too hard for me, i dont understand.

or maybe help add some code to my script
ibamibrhm
 
Posts: 2
Joined: Tue May 01, 2018 10:42 pm


Return to General Support & Discussions

Who is online

Users browsing this forum: andrewr and 11 guests

-->