Looping through a specific part of a script

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
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
Wada
Posts: 9
Joined: Tue Mar 05, 2019 7:51 am

Looping through a specific part of a script

Post by Wada » Tue Mar 05, 2019 8:06 am

Hi

I'm a newbie to imacros but it comes so highly recommended i thought to give it a whirl. I'm trying to fill in and submit data on a web page off a csv file.
While i'm able to find my way through this, the loop runs such that the login page of the website has to be loaded and filled for every instance of data entry.
Is it possible to have the login part of the code run just once, and then the looping through the csv file can commence?
Apologies if this has been asked before, but i've gone through the forum and couldn't find an answer simple enough for my dense head :-)
In my research i came across this link https://wiki.imacros.net/Loop_after_Query_or_Login and modified my script accordingly but i don't understand the part where it wants me to use iimPlayCode()
Like i said, i'm totally new to this and would appreciate advise
I'm running VERSION BUILD=12.5.503.8802 on an iMacros Browser and a WIndows 10 PC

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

Re: Looping through a specific part of a script

Post by chivracq » Tue Mar 05, 2019 12:00 pm

Wada wrote:
Tue Mar 05, 2019 8:06 am

Code: Select all

VERSION BUILD=12.5.503.8802 on an iMacros Browser and a WIndows 10 PC
Hi

I'm a newbie to imacros but it comes so highly recommended i thought to give it a whirl. I'm trying to fill in and submit data on a web page off a csv file.
While i'm able to find my way through this, the loop runs such that the login page of the website has to be loaded and filled for every instance of data entry.
Is it possible to have the login part of the code run just once, and then the looping through the csv file can commence?
Apologies if this has been asked before, but i've gone through the forum and couldn't find an answer simple enough for my dense head :-)
In my research i came across this link https://wiki.imacros.net/Loop_after_Query_or_Login and modified my script accordingly but i don't understand the part where it wants me to use iimPlayCode()
Like i said, i'm totally new to this and would appreciate advise

I'm running VERSION BUILD=12.5.503.8802 on an iMacros Browser and a WIndows 10 PC

Cheers
Wada
Euh..., yep, but the 'iimPlayCode()' and any 'iimXXX()' Command are Commands to be used with the Scripting Interface (only included in the 'Enterprise' Edition), or using the iMacros for FF Add-on (v9.0.3 or v8.9.7, not supported in v10.0.2 for FF) with '.js' Scripts.

To implement that Functionality in pure '.iim', you need to conditionally "mute" the first part (about the 'Login') using 'EVAL()' to be only executed once for '!LOOP=1'.

And adapted to "your" Example from the Wiki, that would give stg like:

Code: Select all

TAB T=1
TAB CLOSEALLOTHERS

'URL GOTO=http://www.google.com/
'TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:gbqf ATTR=NAME:q CONTENT=iOpus
'TAG POS=1 TYPE=BUTTON:SUBMIT FORM=NAME:gbqf ATTR=NAME:btnG

SET URL_Loop1 http://www.google.com/
SET URL_Cond EVAL("var n='{{!LOOP}}', u='{{URL_Loop1}}'; var z; if(n==1){z=u;} else{z='';}; z;")
SET Mute EVAL("var n='{{!LOOP}}'; var z; if(n==1){z=1;} else{z=0;}; z;")

SET !TIMEOUT_STEP {{Mute}}

'Conditional part to run only for '!LOOP=1':
SET !ERRORIGNORE YES
URL GOTO={{URL_Cond}}
TAG POS={{Mute}} TYPE=INPUT:TEXT FORM=NAME:gbqf ATTR=NAME:q CONTENT=iOpus
TAG POS={{Mute}} TYPE=BUTTON:SUBMIT FORM=NAME:gbqf ATTR=NAME:btnG
SET !ERRORIGNORE NO

'Rest of the Script:
SET !LOOP 1
'SET !DATASOURCE xxx
'SET !DATASOURCE_COLUMNS 4
'SET !DATASOURCE_LINE {{!LOOP}}

TAG POS={{!LOOP}} TYPE=A ATTR=CLASS:l&&TXT:*&&HREF:*
SAVEAS TYPE=CPL FOLDER=* FILE=+_{{!NOW:yyyymmdd_hhnnss}}   
BACK
- (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...
Wada
Posts: 9
Joined: Tue Mar 05, 2019 7:51 am

Re: Looping through a specific part of a script

Post by Wada » Wed Mar 13, 2019 6:52 am

Hi,

Many thanks indeed for this. I eventually downloaded the enterprise version(trial) and exported the script to vbs, so was eventually able to use the playcode() as contained in the link. However, can you please point me in the direction where i can learn more about using EVAL()? Looking through your thread, it appears that apart from this, it is a way i can implement "IF" conditions in imacros. The examples you gave assume a fore-knowledge of the principles, but like i said, i'm a total newbie. Not afraid of reading to understand the concepts though :D .
As before, I'm running VERSION BUILD=12.5.503.8802 on an iMacros Browser and a WIndows 10 PC

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

Re: Looping through a specific part of a script

Post by chivracq » Wed Mar 13, 2019 7:03 am

Wada wrote:
Wed Mar 13, 2019 6:52 am
Hi,

Many thanks indeed for this. I eventually downloaded the enterprise version(trial) and exported the script to vbs, so was eventually able to use the playcode() as contained in the link. However, can you please point me in the direction where i can learn more about using EVAL()? Looking through your thread, it appears that apart from this, it is a way i can implement "IF" conditions in imacros. The examples you gave assume a fore-knowledge of the principles, but like i said, i'm a total newbie. Not afraid of reading to understand the concepts though :D .
As before, I'm running VERSION BUILD=12.5.503.8802 on an iMacros Browser and a WIndows 10 PC

Cheers
Wada
Oh, good...!, some Follow-up after 1 week... :D

Okay..., hum, not sure about which specific Thread of mine you are referring to, but there is one Thread where I gave some Explanation about several "Techniques" I use myself for Conditional Logic (in pure '.iim, I don't use any '.js' Scripts) and where I sometimes add a few "interesting" Threads in a List that I maintain in it...:
- Workarounds for Conditional Logic in Macro Code
And searching the Forum (on my Posts) about "anything" that could be "Conditional" will also yield many Results and relevant Threads... :idea:
- (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...
Wada
Posts: 9
Joined: Tue Mar 05, 2019 7:51 am

Re: Looping through a specific part of a script

Post by Wada » Wed Mar 13, 2019 11:05 pm

Thank you very much. Apologies for the late response, i was engaged with some other projects. I'll look through those links and hopefully will be able to implement it :D . Will let you know how it goes. The idea is to have a thorough understanding of imacros before i recommend it for purchase to my employer.

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

Re: Looping through a specific part of a script

Post by chivracq » Thu Mar 14, 2019 1:45 am

Wada wrote:
Wed Mar 13, 2019 11:05 pm
Thank you very much. Apologies for the late response, i was engaged with some other projects. I'll look through those links and hopefully will be able to implement it :D . Will let you know how it goes. The idea is to have a thorough understanding of imacros before i recommend it for purchase to my employer.

Cheers
Wada
Hum, OK...
Don't take anything "hard" or "personal", I will just give you my "Feedback", and maybe trying to "explain" how "this" forum works... :wink:

=> "i was engaged with some other projects."
Yeah, stupid Answer, this is no Excuse, ah-ah...! :lol:
I replied within a few hours, hum, and probably within less than 1 hour after I approved your Thread, and you got some automatic Notifications per E-Mails directly after I approved your Post... 8)
If "engaged with other projects", and don't/won't have the time to respond, then wait until you will have a few hours "to spare"... :roll:
And a "Quality" Reply on a TechForum within just a few hours like I did is very rare... Try to ask your Qt next time on SOF (Stackoverflow) or any other Forum you think might be relevant..., yeah, you'll be happy if you get any Reply after 1 week...! :idea:

=> "I'll look through those links and hopefully will be able to implement it :D . Will let you know how it goes."
OK, good-good... :wink:

=> "The idea is to have a thorough understanding of imacros before i recommend it for purchase to my employer."
Hum, this is another a bit "stupid" Assumption, sorry...! How do you expect to have some "thorough understanding" on any product if you can only spend 10 sec, hum maybe 10 min...!, on that Product every 8 days...!? Sounds a bit like a Joke to me, sorry...! :shock:

I'm probably 20x times more clever than you (at least of course...! :wink: ) (and with more Experience), but sorry I wouldn't be able to do it...! :)
Even if hum, I've assessed/tested many Softwares in my Professional "Life", and yep, I already have "an Opinion" within 10 min, and then within 30 min, and the one I will have for '10 min' is usually correct in 80% of the Cases and the one for '30 min' is then correct in 90% of the Cases, compared with my Opinion after several Hours (or Days) digging into and "playing" with/testing a bit more thoroughly the "Product"... :wink:

=> Dedicate one Day of your Time/Work to first do your own Playing/Testing with iMacros, and I'll be available to answer your Qt's a bit IRT (but not if you reply 8 days later...!, yeah, sorry...!!), or ask sbd else in your Organisation to take that time..., hum, and is clever enough to get their own Opinion and do their own Testing by themselves, I won't be answering Qt's if the Answer(s) can be found in the FAQ or in the Wiki... :twisted:

Hum, or maybe ask Pre-Sales or TechSup, maybe they provide that kind of "Service"..., but hum..., OK if "TechSup", the Guys are good, but I wouldn't really trust any "Pre-Sales" Contact, you will only get some "Bullshit-Marketing" Demo supposed to impress, ah-ah...! :|

(And I'm just a Voluntary (Advanced) User helping other Users, I don't care (expressed very nicely) if you or your Org are going to buy some License(s), I only help Users that are "motivated" and are "really stuck" in their Implementation and use the Forum "a bit correctly"..., ah-ah...! :idea: )
[And 1st Follow-up after 8 days definitely doesn't qualify for my "a bit correctly" Criteria, just saying, ah-ah...! Hum, OK, I'm not too harsh, you came back and tried to explain, Okay...! :wink: ]

>>>

Recap:
=> Hum, any Qt's in this (Follow-up) Post...?
Oh..., nope...! You (= @OP) were going to go playing and investigate the "Product" a bit for "Recommendation"... OK, good-good...! 8)

Oh and hum, some "mini-Detail" that might be "important" especially if you don't really like "my Style", as I mentioned, I help Users on the Forum which are usually Users using any of the 'Free' Editions/Add-ons, but if you end up buying any License for the 'Pro' or 'Enterprise' Edition, you will then have Direct Access to TechSup, and they are much-much nicer than me, ah-ah...! 8)
And you won't have to deal with me for 1 big-full year, youpidoo!, that should give you enough time to learn and master iMacros "thoroughly" enough to never need to have to ask for any Help from the Forum... Wonderful World though...!? :P
- (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...
Wada
Posts: 9
Joined: Tue Mar 05, 2019 7:51 am

Re: Looping through a specific part of a script

Post by Wada » Thu Mar 14, 2019 2:51 am

Hi,

It appears you misunderstand me and are taking my comments the wrong way. While i wouldn't want to drag issues, i did check the following day but there was no response. I assume the time difference may have been an issue (I'm in Australia), also i didn't get any notification in my email when my post was approved. I checked again yesterday, saw it had been responded to and replied right away. I'll check my junk folder in case it went in there. Thanks for alerting me to that.

Apologies if i may have misrepresented my facts.

Grateful for the help you proffer to people like myself on the forum.

Cheers
Wada

P/S : Just checked and there was no notification in my junk folder either.
chivracq
Posts: 8693
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Looping through a specific part of a script

Post by chivracq » Thu Mar 14, 2019 7:15 pm

Yep, you should have received some automatic Notification (per E-mail) indeed when I had approved the Post, and I guess I posted my Answer with your Script less than 1 hour later... But OK, never mind, I was also doing a bit my "Drama Queen" in my last Posts, ah-ah...! :wink:

Well,, you now have all "Info" to adapt your own Script to your Needs using the Example you had given and that I modified in this Thread, and I gave you some Link to some other Thread with a lot of Info about Conditional Logic in pure '.iim'.

And otherwise, yep, if you can use the 'Enterprise' Edition, that's the "Royal Way" with the 'Scripting Interface', and you can then use any Prog Language, like '.VBS' for example and you then have much more Control than just with 'Relative Positioning' + 'EVAL()' in pure '.iim'.
- (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...
Wada
Posts: 9
Joined: Tue Mar 05, 2019 7:51 am

Re: Looping through a specific part of a script

Post by Wada » Fri Mar 15, 2019 1:46 am

Hi,

Many thanks indeed for your prompt response, it is sincerely appreciated.

Do you know if there's any possible reason i don't receive notifications by email when my posts are approved or responded to?

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

Re: Looping through a specific part of a script

Post by chivracq » Fri Mar 15, 2019 2:24 am

Wada wrote:
Fri Mar 15, 2019 1:46 am
Hi,

Many thanks indeed for your prompt response, it is sincerely appreciated.

Do you know if there's any possible reason i don't receive notifications by email when my posts are approved or responded to?

Cheers
Wada
The Default 'Behaviour" if you had not changed any Settings in your 'ucp' (User Control Panel) is that you should receive Notifs "inside" the Forum once you are logged in and for a few by E-mail also...
Review those Settings here...
['ucp' => 'Board preferences' => 'Edit notification options']
- (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...
Wada
Posts: 9
Joined: Tue Mar 05, 2019 7:51 am

Re: Looping through a specific part of a script

Post by Wada » Fri Mar 15, 2019 4:53 am

Ah i see! The email checkboxes were not ticked. Done them now. I should get notified when stuff happens now :D

Many thanks

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

Re: Looping through a specific part of a script

Post by chivracq » Fri Mar 15, 2019 4:59 am

Wada wrote:
Fri Mar 15, 2019 4:53 am
Ah i see! The email checkboxes were not ticked. Done them now. I should get notified when stuff happens now :D

Many thanks

Cheers
Wada
Mini-Test then...! :wink:
- (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...
Wada
Posts: 9
Joined: Tue Mar 05, 2019 7:51 am

Re: Looping through a specific part of a script

Post by Wada » Sun Mar 17, 2019 11:45 pm

Nope! still no notification. I must have screwed up something. I'll do another check of the settings.

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

Re: Looping through a specific part of a script

Post by chivracq » Mon Mar 18, 2019 12:03 am

Wada wrote:
Sun Mar 17, 2019 11:45 pm
Nope! still no notification. I must have screwed up something. I'll do another check of the settings.

Cheers
Wada
Hum, strange...! :o

Under 'ucp' => 'Board preferences' => 'Edit posting defaults' (Direct Link), you must also make sure you don't have disabled "Notify me upon replies by default"...
And/or that each time you post in a Thread or start one, you don't "contradict" that Setting from the "Notify me when a reply is posted" Option for any of your Posts...

Hum, and also check at the Bottom/Left of the Thread, next to the 'Post Reply' Button => under the 'Topic Tools' DDLB, that you haven't "inadvertently" clicked on "Unsubscribe Topic"... That Toggle Menu Item is not very-very clear about its "Functionality"...
- (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...
Wada
Posts: 9
Joined: Tue Mar 05, 2019 7:51 am

Re: Looping through a specific part of a script

Post by Wada » Wed Mar 27, 2019 2:33 am

Brilliant! "Notify me upon replies by default" was disabled. I've enabled it now.

Many thanks indeed for all your help. I really appreciate.

Cheers
Wada
Post Reply