LOOP
Forum rules
iMacros EOL - Attention!
The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely,
The Progress Team
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
iMacros EOL - Attention!
The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely,
The Progress Team
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
LOOP
I posted this somewhere else but no one answered i am sorry for the Dub.
Can i define the number of times i want a scrip to repeat it self in side the macro file (iim file)?
Thanks,
Can i define the number of times i want a scrip to repeat it self in side the macro file (iim file)?
Thanks,
Re: LOOP
Hello,
No problem, I deleted the other one. To your question:
No problem, I deleted the other one. To your question:
No, you just have the option on the user interface ("Repeat Macro/Max:").TNT wrote:Can i define the number of times i want a scrip to repeat it self in side the macro file (iim file)?
-
- Posts: 190
- Joined: Wed Aug 06, 2008 2:38 am
Re: LOOP
The other option is to write a script that can call your macro in a scripting language like VBS or Javascript. You can define the loop in the scripting language to be whatever size you need, and then have it call the macro.Marcia, iOpus wrote:Hello,
No problem, I deleted the other one. To your question:
No, you just have the option on the user interface ("Repeat Macro/Max:").TNT wrote:Can i define the number of times i want a scrip to repeat it self in side the macro file (iim file)?
Hope this helps.
Re: LOOP
This is how to do a loop in JS, to change the amount of times it loops you change the section I have made bold and underlined. This script searches google for a random number.
var macro;
var jsLF = "\n";
var i, retcode, errtext;
for (i=0;i<=1000;i++) {
var randomnumber = Math.floor(Math.random()*1000);
/* Create the Macro */
macro = "CODE:";
macro += "URL GOTO=http://www.google.com" + jsLF;
macro += "TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:f ATTR=NAME:q CONTENT=" + randomnumber + jsLF;
macro += "TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:f ATTR=NAME:btnG&&VALUE:Google<SP>Search" + jsLF;
macro += "WAIT SECONDS=25" + jsLF;
retcode = iimPlay(macro);
if (retcode < 0) { // an error has occured
errtext = iimGetLastError();
alert(errtext);
}
if (retcode < 0) { // an error has occured
errtext = iimGetLastError();
alert(errtext);
break;
}
}
Re: LOOP
I'm getting the following error when I try to run this using iMacro
SyntaxError: unknown command: VAR at line 1
Why won't it let me declare the variable "i".
I commented out the "var i;", and it gave me the same error for the "for (i=0;i<=5;i++)"
SyntaxError: unknown command: FOR at line 2
SyntaxError: unknown command: VAR at line 1
If I can get this loop working it would cut down 760 lines of code into 60 flat...var i;
for (i=0;i<=5;i++)
{
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:win0 ATTR=ID:GP_TEST=i
TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:middle&&ALT:Save<SP>(Alt+1)&&NAME:Save&&SRC:/cs/TEST/cache/PT_SAVE_1.gif
TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:middle&&ALT:Next<SP>in<SP>list<SP>(Alt+3)&&NAME:Next<SP>in<SP>List&&SRC:/cs/TEST/cache/PT_NEXTINLIST_1.gif
}
Why won't it let me declare the variable "i".
I commented out the "var i;", and it gave me the same error for the "for (i=0;i<=5;i++)"
SyntaxError: unknown command: FOR at line 2
Re: LOOP
What you're doing there is interspersing iMacros scripting language (all the TAG POS ... lines) with JavaScript. That won't work. It's like mixing Russian and Chinese in the same document and expecting the reader to know both languages and be able to determine when you switched from one to the other.rouge02 wrote:I'm getting the following error when I try to run this using iMacro
SyntaxError: unknown command: VAR at line 1
If I can get this loop working it would cut down 760 lines of code into 60 flat...var i;
for (i=0;i<=5;i++)
{
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:win0 ATTR=ID:GP_TEST=i
TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:middle&&ALT:Save<SP>(Alt+1)&&NAME:Save&&SRC:/cs/TEST/cache/PT_SAVE_1.gif
TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:middle&&ALT:Next<SP>in<SP>list<SP>(Alt+3)&&NAME:Next<SP>in<SP>List&&SRC:/cs/TEST/cache/PT_NEXTINLIST_1.gif
}
Why won't it let me declare the variable "i".
I commented out the "var i;", and it gave me the same error for the "for (i=0;i<=5;i++)"
SyntaxError: unknown command: FOR at line 2
Try this: Open a text editor and paste in the following code: -
Javascript: ...\iMacros\Macros\multiPlay.js
Code: Select all
const iterations = 100; // Number of times to loop
for (var i=0; i<iterations; i++){
iimSet('iteration', i );
iimPlay('multiPlay');
}
NOTE the 'JS' file extension
Create a new text file and paste in the following code: -
iMacros scripting language: ...\iMacros\Macros\multiPlay.iim
Code: Select all
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:win0 ATTR=ID:GP_TEST={{iteration}}
TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:middle&&ALT:Save<SP>(Alt+1)&&NAME:Save&&SRC:/cs/TEST/cache/PT_SAVE_1.gif
TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:middle&&ALT:Next<SP>in<SP>list<SP>(Alt+3)&&NAME:Next<SP>in<SP>List&&SRC:/cs/TEST/cache/PT_NEXTINLIST_1.gif
NOTE the 'IIM' file extension
In your iMacros for Firefox plugin window, run the macro multiPlay.JS (not the iim)
The javascript executes the iMacros script and passes the iteration value to it.
You can rename the files to suit you, but remember to change the javascript file to execute the imacros script file with the name you gave it.
You can also change the number of loop iterations by changing
Loop 100 times
Code: Select all
const iterations = 100; // Number of times to loop
Loop 50 times
Code: Select all
const iterations = 50; // Number of times to loop
Re: LOOP
Firstly thanks for your reply....
Secondly rofl @ Russian and Chinese... LoL
It would have been great if it allowed me to do just that...
If I'm reading your example correctly.. It solves the issue of my "i" increasing with each loop
But not actually looping the iMacro part of the code.
The first part of my script handles the first task, which only needs to be run once.
Then when it gets to this part;
I want it to not only loop the iMacro script a specific number of times but with each loop the "i" must also increase by 1 (which is where your nice piece of code will come in handy).
I know iMacro has a general # of times to run script, but I don't want it looping the entire script. Only that section of code, once the "i" hits its target # then continue to end.
Again thanks for taking the time to reply
I'll see what I can come up with in the mean time, with what you've given me so far.
Secondly rofl @ Russian and Chinese... LoL
It would have been great if it allowed me to do just that...
If I'm reading your example correctly.. It solves the issue of my "i" increasing with each loop
But not actually looping the iMacro part of the code.
The first part of my script handles the first task, which only needs to be run once.
Then when it gets to this part;
Code: Select all
// with each loop i needs to be incremented by 1. i.e. 1-24 .. 3 lines of code to be executed 24 times, with i changing from 1-24 with each loop
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:win0 ATTR=ID:GP_TEST=i
TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:middle&&ALT:Save<SP>(Alt+1)&&NAME:Save&&SRC:/cs/TEST/cache/PT_SAVE_1.gif
TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:middle&&ALT:Next<SP>in<SP>list<SP>(Alt+3)&&NAME:Next<SP>in<SP>List&&SRC:/cs/TEST/cache/PT_NEXTINLIST_1.gif
I know iMacro has a general # of times to run script, but I don't want it looping the entire script. Only that section of code, once the "i" hits its target # then continue to end.
Again thanks for taking the time to reply
I'll see what I can come up with in the mean time, with what you've given me so far.
Re: LOOP
It will do what you want, because the Javascript piece has the loop that increments the {{iteration}} variable each time.rouge02 wrote:Firstly thanks for your reply....
Secondly rofl @ Russian and Chinese... LoL
It would have been great if it allowed me to do just that...
If I'm reading your example correctly.. It solves the issue of my "i" increasing with each loop
But not actually looping the iMacro part of the code.
The first part of my script handles the first task, which only needs to be run once.
Then when it gets to this part;
I want it to not only loop the iMacro script a specific number of times but with each loop the "i" must also increase by 1 (which is where your nice piece of code will come in handy).Code: Select all
// with each loop i needs to be incremented by 1. i.e. 1-24 .. 3 lines of code to be executed 24 times, with i changing from 1-24 with each loop TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:win0 ATTR=ID:GP_TEST=i TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:middle&&ALT:Save<SP>(Alt+1)&&NAME:Save&&SRC:/cs/TEST/cache/PT_SAVE_1.gif TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:middle&&ALT:Next<SP>in<SP>list<SP>(Alt+3)&&NAME:Next<SP>in<SP>List&&SRC:/cs/TEST/cache/PT_NEXTINLIST_1.gif
I know iMacro has a general # of times to run script, but I don't want it looping the entire script. Only that section of code, once the "i" hits its target # then continue to end.
Again thanks for taking the time to reply
I'll see what I can come up with in the mean time, with what you've given me so far.
Here's a step by step breakdown of the javascript code
A setting for the maximum number of times the macro will be run. E.G. 100 times
Code: Select all
const iterations = 100; // Number of times to loop
Code: Select all
for (var i=0; i<iterations; i++){
Code: Select all
iimSet('iteration', i );
Code: Select all
iimPlay('multiPlay');
Code: Select all
}
Note: If you want to go from 1 to 100 instead of 0 to 99, simply change this line of code from: -
Code: Select all
iimSet('iteration', i );
Code: Select all
iimSet('iteration', i + 1);
Re: LOOP
Ok so I understand that, but let me give you the bigger picture here..
This first piece of code starts off my iMacro script...
Once complete it continues to the following, and this entire section of code needs to be looped 24 times.
And "i" needs to be changed from 1 - 24 with each loop.. <=which i understand how to do based on what you've given me
'NOTE AT THE POINT WHERE IT SAYS 'STREAM #1 of 24 THAT CODE POSTED WILL COME INTO PLAY HERE TO INCREASE
THE VALUE OF i BY 1 AT EACH LOOP
So I was thinking either I separate the first piece of code from the second and insert a call to the second piece of code so that
I can use iMacro's Repeat, to repeat the whole of the second macro, X amount of times.
Or figure out how to loop the 2nd piece of code 24 times.. and still
use your code to change the value of i from 1 - 24 respectively.
This first piece of code starts off my iMacro script...
Code: Select all
VERSION BUILD=6240709 RECORDER=FX
TAB T=1
'TESTING URL
URL GOTO=http://testing.serv1.ttl:7110/psp/TESTING/c/MANAGE_PROCESS_(GBL).GP_RUNCTL.GBL
'SEARCH testing TEST RUN CONTROL
FRAME F=3
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:win0 ATTR=ID:PRCSRUNCNTL_RUN_CNTL_ID CONTENT=testing
TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:middle&&ALT:Search<SP>(Alt+1)&&NAME:Search&&SRC:/cs/TESTING/cache/PT_SEARCH_1.gif
WAIT SECONDS=2
'SELECT testing01 FROM SEARCH RESULTS
TAG POS=1 TYPE=A ATTR=CLASS:PSSRCHRESULTSODDROW&&TABINDEX:34&&HREF:javascript:<SP>submitAction_win0(document,'win0','#ICRow12');
And "i" needs to be changed from 1 - 24 with each loop.. <=which i understand how to do based on what you've given me
Code: Select all
'ENTER CALENDAR GROUP ID
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:win0 ATTR=ID:GP_RUNCTL_CAL_RUN_ID CONTENT=TESTING009
TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:absmiddle&&ALT:Look<SP>up<SP>Calendar<SP>Group<SP>ID<SP>(Alt+5)&&SRC:/cs/TESTING/cache/PT_PROMPT_LOOKUP_1.gif
WAIT SECONDS=2
TAG POS=1 TYPE=A ATTR=CLASS:PSSRCHRESULTSODDROW&&TABINDEX:21&&HREF:javascript:<SP>submitAction_win0(document,'win0','#ICRow0');&&NAME:SEARCH_RESULT1
'SELECT IDENTIFY + CALCULATE + RECALCULATE
FRAME F=3
WAIT SECONDS=1
TAG POS=1 TYPE=LABEL ATTR=CLASS:PSCHECKBOX&&FOR:GP_RUNCTL_RUN_IDNT_IND
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:win0 ATTR=ID:GP_RUNCTL_RUN_IDNT_IND CONTENT=YES
WAIT SECONDS=1
TAG POS=1 TYPE=LABEL ATTR=CLASS:PSCHECKBOX&&FOR:GP_RUNCTL_RUN_CALC_IND$24$
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:win0 ATTR=ID:GP_RUNCTL_RUN_CALC_IND$24$ CONTENT=YES
WAIT SECONDS=1
TAG POS=1 TYPE=LABEL ATTR=CLASS:PSCHECKBOX&&FOR:GP_RUNCTL_RUN_RECALC_ALL_IND
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:win0 ATTR=ID:GP_RUNCTL_RUN_RECALC_ALL_IND CONTENT=YES
WAIT SECONDS=1
'STREAM #1 of 24
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:win0 ATTR=ID:GP_RUNCTL_STRM_NUM CONTENT=i
'SAVE PARAMETERS
TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:middle&&ALT:Save<SP>(Alt+1)&&NAME:Save&&SRC:/cs/TESTING/cache/PT_SAVE_1.gif
WAIT SECONDS=2
'GO TO NEXT IN LIST
TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:middle&&ALT:Next<SP>in<SP>list<SP>(Alt+3)&&NAME:Next<SP>in<SP>List&&SRC:/cs/TESTING/cache/PT_NEXTINLIST_1.gif
'END-OF-STREAM~END-OF-STREAM~END-OF-STREAM~END-OF-STREAM~END-OF-STREAM~END-OF-STREAM~END-OF-STREAM~END-
THE VALUE OF i BY 1 AT EACH LOOP
So I was thinking either I separate the first piece of code from the second and insert a call to the second piece of code so that
I can use iMacro's Repeat, to repeat the whole of the second macro, X amount of times.
Or figure out how to loop the 2nd piece of code 24 times.. and still
use your code to change the value of i from 1 - 24 respectively.
Re: LOOP
That can be easily achieved with a small change.
Separate the part before the loop and save it as preLoop.iim
Then save the loop section as loopSection.iim Note: I replaced CONTENT=i with CONTENT={{i}} because {{i}} is now passed from JavaScript to the iMacros script
Then save the rest as postLoop.iim
Then modify your JavaScript to run all 3 iMacros
If everything from 'STREAM #1 of 24 onwards is needed in the loop, do this
Separate the part before the loop and save it as preLoop.iim
Then save the loop section as loopSection.iim Note: I replaced CONTENT=i with CONTENT={{i}} because {{i}} is now passed from JavaScript to the iMacros script
Then modify your JavaScript to run both iMacros
Note: No post loop section.
Separate the part before the loop and save it as preLoop.iim
Code: Select all
VERSION BUILD=6240709 RECORDER=FX
TAB T=1
'TESTING URL
URL GOTO=http://testing.serv1.ttl:7110/psp/TESTING/c/MANAGE_PROCESS_(GBL).GP_RUNCTL.GBL
'SEARCH testing TEST RUN CONTROL
FRAME F=3
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:win0 ATTR=ID:PRCSRUNCNTL_RUN_CNTL_ID CONTENT=testing
TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:middle&&ALT:Search<SP>(Alt+1)&&NAME:Search&&SRC:/cs/TESTING/cache/PT_SEARCH_1.gif
WAIT SECONDS=2
'SELECT testing01 FROM SEARCH RESULTS
TAG POS=1 TYPE=A ATTR=CLASS:PSSRCHRESULTSODDROW&&TABINDEX:34&&HREF:javascript:<SP>submitAction_win0(document,'win0','#ICRow12');
'ENTER CALENDAR GROUP ID
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:win0 ATTR=ID:GP_RUNCTL_CAL_RUN_ID CONTENT=TESTING009
TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:absmiddle&&ALT:Look<SP>up<SP>Calendar<SP>Group<SP>ID<SP>(Alt+5)&&SRC:/cs/TESTING/cache/PT_PROMPT_LOOKUP_1.gif
WAIT SECONDS=2
TAG POS=1 TYPE=A ATTR=CLASS:PSSRCHRESULTSODDROW&&TABINDEX:21&&HREF:javascript:<SP>submitAction_win0(document,'win0','#ICRow0');&&NAME:SEARCH_RESULT1
'SELECT IDENTIFY + CALCULATE + RECALCULATE
FRAME F=3
WAIT SECONDS=1
TAG POS=1 TYPE=LABEL ATTR=CLASS:PSCHECKBOX&&FOR:GP_RUNCTL_RUN_IDNT_IND
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:win0 ATTR=ID:GP_RUNCTL_RUN_IDNT_IND CONTENT=YES
WAIT SECONDS=1
TAG POS=1 TYPE=LABEL ATTR=CLASS:PSCHECKBOX&&FOR:GP_RUNCTL_RUN_CALC_IND$24$
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:win0 ATTR=ID:GP_RUNCTL_RUN_CALC_IND$24$ CONTENT=YES
WAIT SECONDS=1
TAG POS=1 TYPE=LABEL ATTR=CLASS:PSCHECKBOX&&FOR:GP_RUNCTL_RUN_RECALC_ALL_IND
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:win0 ATTR=ID:GP_RUNCTL_RUN_RECALC_ALL_IND CONTENT=YES
WAIT SECONDS=1
Code: Select all
'STREAM #1 of 24
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:win0 ATTR=ID:GP_RUNCTL_STRM_NUM CONTENT={{i}}
Code: Select all
'SAVE PARAMETERS
TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:middle&&ALT:Save<SP>(Alt+1)&&NAME:Save&&SRC:/cs/TESTING/cache/PT_SAVE_1.gif
WAIT SECONDS=2
'GO TO NEXT IN LIST
TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:middle&&ALT:Next<SP>in<SP>list<SP>(Alt+3)&&NAME:Next<SP>in<SP>List&&SRC:/cs/TESTING/cache/PT_NEXTINLIST_1.gif
'END-OF-STREAM~END-OF-STREAM~END-OF-STREAM~END-OF-STREAM~END-OF-STREAM~END-OF-STREAM~END-OF-STREAM~END-
Then modify your JavaScript to run all 3 iMacros
Code: Select all
const iterations = 24; // Number of times to loop
//Run the bit before the loop
iimPlay('preLoop');
//Start Of Loop
for (var i=0; i<iterations; i++){
iimSet('i', i + 1); //increment {{i}} each time 1 to 24
iimPlay('loopSection');
} // End Of Loop
// Run the bit after the loop
iimPlay('postLoop');
Separate the part before the loop and save it as preLoop.iim
Code: Select all
VERSION BUILD=6240709 RECORDER=FX
TAB T=1
'TESTING URL
URL GOTO=http://testing.serv1.ttl:7110/psp/TESTING/c/MANAGE_PROCESS_(GBL).GP_RUNCTL.GBL
'SEARCH testing TEST RUN CONTROL
FRAME F=3
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:win0 ATTR=ID:PRCSRUNCNTL_RUN_CNTL_ID CONTENT=testing
TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:middle&&ALT:Search<SP>(Alt+1)&&NAME:Search&&SRC:/cs/TESTING/cache/PT_SEARCH_1.gif
WAIT SECONDS=2
'SELECT testing01 FROM SEARCH RESULTS
TAG POS=1 TYPE=A ATTR=CLASS:PSSRCHRESULTSODDROW&&TABINDEX:34&&HREF:javascript:<SP>submitAction_win0(document,'win0','#ICRow12');
'ENTER CALENDAR GROUP ID
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:win0 ATTR=ID:GP_RUNCTL_CAL_RUN_ID CONTENT=TESTING009
TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:absmiddle&&ALT:Look<SP>up<SP>Calendar<SP>Group<SP>ID<SP>(Alt+5)&&SRC:/cs/TESTING/cache/PT_PROMPT_LOOKUP_1.gif
WAIT SECONDS=2
TAG POS=1 TYPE=A ATTR=CLASS:PSSRCHRESULTSODDROW&&TABINDEX:21&&HREF:javascript:<SP>submitAction_win0(document,'win0','#ICRow0');&&NAME:SEARCH_RESULT1
'SELECT IDENTIFY + CALCULATE + RECALCULATE
FRAME F=3
WAIT SECONDS=1
TAG POS=1 TYPE=LABEL ATTR=CLASS:PSCHECKBOX&&FOR:GP_RUNCTL_RUN_IDNT_IND
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:win0 ATTR=ID:GP_RUNCTL_RUN_IDNT_IND CONTENT=YES
WAIT SECONDS=1
TAG POS=1 TYPE=LABEL ATTR=CLASS:PSCHECKBOX&&FOR:GP_RUNCTL_RUN_CALC_IND$24$
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:win0 ATTR=ID:GP_RUNCTL_RUN_CALC_IND$24$ CONTENT=YES
WAIT SECONDS=1
TAG POS=1 TYPE=LABEL ATTR=CLASS:PSCHECKBOX&&FOR:GP_RUNCTL_RUN_RECALC_ALL_IND
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:win0 ATTR=ID:GP_RUNCTL_RUN_RECALC_ALL_IND CONTENT=YES
WAIT SECONDS=1
Code: Select all
'STREAM #1 of 24
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:win0 ATTR=ID:GP_RUNCTL_STRM_NUM CONTENT={{i}}
'SAVE PARAMETERS
TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:middle&&ALT:Save<SP>(Alt+1)&&NAME:Save&&SRC:/cs/TESTING/cache/PT_SAVE_1.gif
WAIT SECONDS=2
'GO TO NEXT IN LIST
TAG POS=1 TYPE=IMG ATTR=BORDER:0&&ALIGN:middle&&ALT:Next<SP>in<SP>list<SP>(Alt+3)&&NAME:Next<SP>in<SP>List&&SRC:/cs/TESTING/cache/PT_NEXTINLIST_1.gif
'END-OF-STREAM~END-OF-STREAM~END-OF-STREAM~END-OF-STREAM~END-OF-STREAM~END-OF-STREAM~END-OF-STREAM~END-
Then modify your JavaScript to run both iMacros
Code: Select all
const iterations = 24; // Number of times to loop
//Run the bit before the loop
iimPlay('preLoop');
//Start Of Loop
for (var i=0; i<iterations; i++){
iimSet('i', i + 1); //increment {{i}} each time 1 to 24
iimPlay('loopSection');
} // End Of Loop
-
- Posts: 17
- Joined: Thu Oct 22, 2009 8:29 pm
Re: LOOP
Great Topic!
Quick question though
How would I tell the script to loop between a number range
ie.
I want to loop between lines 25-40 on my csv file
is there an easy way to tell the javascript how to do this?
Quick question though
How would I tell the script to loop between a number range
ie.
I want to loop between lines 25-40 on my csv file
is there an easy way to tell the javascript how to do this?
Re: LOOP
Hi ng.tinyreef, can we get a little more info about your csv file. off the bat i'm thinking for you to just put lines 25-40 in a separate csv file..
or just use the { } brackets to isolate that part of the script, but as i've learned with my inatial loop issue it's never quite that simple..
as my boy Murphy would say;
--every solution breeds new problems
--there's always one more bug
or just use the { } brackets to isolate that part of the script, but as i've learned with my inatial loop issue it's never quite that simple..
as my boy Murphy would say;
--every solution breeds new problems
--there's always one more bug
Re: LOOP
Code: Select all
for (var i=25; i<=40; i++){
iimSet('i', i); //increment {{i}} each time 25 to 40
iimPlay('loopSection');
}
Re: LOOP
I don't think that is quite what he had in mind.
He said;
As i was corrected earlier for mixing iMacro script and javascript;
He said;
Looping lines of script is another matter altogether.ng.tinyreef wrote: ....cut....
I want to loop between lines 25-40 on my csv file
is there an easy way to tell the javascript how to do this?
As i was corrected earlier for mixing iMacro script and javascript;
ABooth wrote:...cut... What you're doing there is interspersing iMacros scripting language (all the TAG POS ... lines) with JavaScript. That won't work. It's like mixing Russian and Chinese in the same document and expecting the reader to know both languages and be able to determine when you switched from one to the other.