how to loop from certain line of script

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.

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 to loop from certain line of script

by green.pine on Fri Sep 29, 2017 4:42 am

Hi;
running FF 55.0.3 on Win 7 32 bit, imacros ver. v8.9.7

I did use the script on this thread with the help of chivracq
http://forum.imacros.net/viewtopic.php?f=11&t=26581&p=71266&hilit=extract+Email#p70484

but I want to do little more on this, and struggle to make it work,
I want the script skip one or few lines of script and continue.
but I could not figure it out how to do it with imacros, I am not sure if this can be done with imacros coding.
found some js loop script on this site, none I could use for this.

I don't think it is needed to paste the script from the link above, because I need only make the loop thing works.
this is what I want to do:

1- TAB 1- go to google and do a search
2- extract the content of the first page results, and click to the next page of the result
3- TAB 2 ,go to second url e.g. xyz.com
4- paste the data in there, extract new data
5- save the new data to a file
6- go back to line 2( which is On TAB 1, the second page of google result)


and continues to line 5, and then again from line 2.
so it is a loop, only the first time it starts at line 1, the second time and further starts from line 2 until the number of loops ends

I need it to set a number of loops as well, I don't want to do the loop unlimited.

appreciate any help on this.
green.pine
 
Posts: 62
Joined: Thu Nov 04, 2010 10:21 am

Re: how to loop from certain line of script

by chivracq on Fri Sep 29, 2017 6:37 am

green.pine wrote:Hi;
running
Code: Select all
FF 55.0.3 on Win 7 32 bit, imacros ver. v8.9.7


I did use the script on this thread with the help of chivracq
http://forum.imacros.net/viewtopic.php?f=11&t=26581&p=71266&hilit=extract+Email#p70484

but I want to do little more on this, and struggle to make it work,
I want the script skip one or few lines of script and continue.
but I could not figure it out how to do it with imacros, I am not sure if this can be done with imacros coding.
found some js loop script on this site, none I could use for this.

I don't think it is needed to paste the script from the link above, because I need only make the loop thing works.
this is what I want to do:

1- TAB 1- go to google and do a search
2- extract the content of the first page results, and click to the next page of the result
3- TAB 2 ,go to second url e.g. xyz.com
4- paste the data in there, extract new data
5- save the new data to a file
6- go back to line 2( which is On TAB 1, the second page of google result)


and continues to line 5, and then again from line 2.
so it is a loop, only the first time it starts at line 1, the second time and further starts from line 2 until the number of loops ends

I need it to set a number of loops as well, I don't want to do the loop unlimited.

appreciate any help on this.

Yep, "Standard" way to achieve what you want would be to use indeed a '.js' Script, but it can as well easily be done in pure '.iim'.
What you want for 'Step_1' is a "Conditional Load of the Page" (+ "Conditional Search")) based on '!LOOP'.

If you want to code it in pure '.iim', search the Forum (my Posts mainly I think) on "Conditional" (+ "EVAL") + one of the following Keywords: "REFRESH" / "Reload" / "URL GOTO" and you'll find Threads where I've explained the "Technique", Threads related to "Nested Loop(s)" would be relevant as well...
And you would apply the same Technique to the 'TAG POS=n' for the 'TAG' Statements on the HTML Elements related to the Search as they would be present on the Google Page to "mute" them with a "TAG POS=0" (which won't do anything...!) after the 1st Run of the Loop, together with '!ERRORIGNORE' of course, and a short '!TIMEOUT_STEP' (=1 or 0), and you can even make the '!TIMEOUT_STEP' "Conditional" if you want, using the same Principle.
I use this Technique (about the Conditional '!TIMEOUT_STEP') indeed myself in a few of my Scripts, to strive for more "Reliability" in some parts of the Script where I know that some HTML Elements that need to be clicked should be there and other parts can run quicker especially if the Elements are not there...

More Info in the following Thread where I've probably already linked to a few relevant Threads for your Scenario as I maintain (sometimes...!) a List of interesting/useful/relevant Threads...:
- Workarounds for Conditional Logic in Macro Code
.
- (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: 6473
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to Data Extraction and Web Screen Scraping

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests

-->