loop the whole macro but with different "Input" each time?

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.

loop the whole macro but with different "Input" each time?

by serppower on Thu Feb 02, 2017 8:28 am

Hi, I am very very noob at this guys so please don't get mad at me :oops:

1- I want to stop at the "current page" when the macro find the "keyword" that i am searching for in it.
2- I want to loop this macro but with different "Input" each time until the CSV file inputs ends but i don't know how to do that.

Here's what i have tried:
Code: Select all
VERSION BUILD=844 RECORDER=CR
URL GOTO=http://gizaedu.gov.eg/natig/3.aspx
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form1 ATTR=ID:TextBox1 CONTENT=10000
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:form1 ATTR=ID:Button1
SET EXTRACT NULL
'if this exist you extract the text(even if you know it)
'if doesn't exist should return error but we turned that off; Extract remains Null
TAG POS=1 TYPE=SMALL ATTR=TXT:Keyword EXTRACT=TXT
SET !VAR1 EVAL("var text=\"{{!EXTRACT}}\"; if(text==\"keyword\") text = \"jibber\"
'this one executes if the text is right, if not should give error but we turned that off
TAG POS=1 TYPE=DIV ATTR=TXT:{{!VAR1}}


My main goal is to input multiple values from the CSV file and each time search the page for the "keyword" and if it's found then just stops and let me "view" the page and if it didn't find the "keyword" i want it to just keep going until the end of the CSV inputs.

I have found this code but i don't know where to place it and how to even use it:

Code: Select all
SET !DATASOURCE key22.csv
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}


I have tried my best but that's what i have come up with i hope you help me to reach my goal.

Thanks in advance.. :)
serppower
 
Posts: 1
Joined: Thu Feb 02, 2017 7:31 am

Re: loop the whole macro but with different "Input" each tim

by chivracq on Thu Feb 02, 2017 1:00 pm

serppower wrote:Hi, I am very very noob at this guys so please don't get mad at me :oops:

1- I want to stop at the "current page" when the macro find the "keyword" that i am searching for in it.
2- I want to loop this macro but with different "Input" each time until the CSV file inputs ends but i don't know how to do that.

Here's what i have tried:
Code: Select all
VERSION BUILD=844 RECORDER=CR
URL GOTO=http://gizaedu.gov.eg/natig/3.aspx
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form1 ATTR=ID:TextBox1 CONTENT=10000
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:form1 ATTR=ID:Button1
SET EXTRACT NULL
'if this exist you extract the text(even if you know it)
'if doesn't exist should return error but we turned that off; Extract remains Null
TAG POS=1 TYPE=SMALL ATTR=TXT:Keyword EXTRACT=TXT
SET !VAR1 EVAL("var text=\"{{!EXTRACT}}\"; if(text==\"keyword\") text = \"jibber\"
'this one executes if the text is right, if not should give error but we turned that off
TAG POS=1 TYPE=DIV ATTR=TXT:{{!VAR1}}


My main goal is to input multiple values from the CSV file and each time search the page for the "keyword" and if it's found then just stops and let me "view" the page and if it didn't find the "keyword" i want it to just keep going until the end of the CSV inputs.

I have found this code but i don't know where to place it and how to even use it:

Code: Select all
SET !DATASOURCE key22.csv
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}


I have tried my best but that's what i have come up with i hope you help me to reach my goal.

Thanks in advance.. :)

Well done...!, Thread finally approved after I waited for a few hours for you to "take it a bit easy" on the Forum and having to delete several of your Duplicates in several Sub-Forums, that's not "the way" this Forum works, one Thread (in the correct Sub-Forum that you finally found) is enough, no need for several Duplicates in several Sub-Forums... :roll:

Next Step will be for you to mention your FCI: => FCIM...! :mrgreen:
=> iMacros for CR v8.4.4, CR...?, OS...?

Then I would send you to study the 'Loop-Csv-2-Web.iim' Demo-Macro which answers your first Qt about using a DataSource for your Search Keywords, and your second Qt about Stopping/Halting your Macro if Keyword is Found would come after...

But I see that you already got some Answer(s) on the SOF Forum, mostly by @Shugar (he's good in general, ah-ah...!) and @Tienkamp (is quite new, I think I noticed one very good Answer by this User recently but I don't check the SOF Forum very often and very rarely answer Threads there as Users never mention their FCI (like you!) and the whole Forum turns a bit too much around Reputation Points)...

=> So OK, you seem to be in good hands already, ah-ah..., post your final Solution in this Thread to finish it neatly and useful for other Users as well, if you ever need some Help again (at least from me) on this Forum...
Even if hum..., in my Opinion, @Shugar's Solution with 'MacroError()' (was my first Idea as well, ah-ah...!) will be a bit cumbersome and not very "practical" for you to use, I would have I think a better Solution, ah-ah...!
(But he could still improve it, ah-ah...!)
The '!ERRORIGNORE' Statements around the 'EXTRACT' Statement are not needed btw...
- (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: 6479
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to General Support & Discussions

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests

-->