Loop, can Imacros tell when your at the end of file?
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, can Imacros tell when your at the end of file?
If I am using the following command,
SET !DATASOURCE_LINE {{!LOOP}}
and I set my Play(Loop) dialog box to a number larger than my file, how can Firefox Imacros tell if you are at the end of the file, and stop? It just continues to run on the last line of my file.
SET !DATASOURCE_LINE {{!LOOP}}
and I set my Play(Loop) dialog box to a number larger than my file, how can Firefox Imacros tell if you are at the end of the file, and stop? It just continues to run on the last line of my file.
Re: Loop, can Imacros tell when your at the end of file?
yes, you can, but have to use a javascript file. i had your same problem and i've done a script for that.
here you are:
1) first make your macro. you have to use some variable that you'll set outside, in the js file:
2) then create a new .js file. i've seen that when the lines are empty, in the url bar appears this: "chrome://browser/content/browser.xul". so i've thought to use that to make imacro stops.
this is the code:
this is all. i've set up imacro to stop even if he founds the #EANF# value. if you don't want that, simply delete the s == 'chrome://browser/content/browser.xul#EANF#' || part from the "if" statement.
tell if it works with you.
Ciauz
p.s. since i'm only a noob, please any of the more experience users can tell me if everything is alright of if i can make any improvement? thanks
here you are:
1) first make your macro. you have to use some variable that you'll set outside, in the js file:
Code: Select all
CMDLINE !DATASOURCE [[your datasource path]]
SET !VAR1
SET !DATASOURCE_COLUMNS [[your number of columns]]
SET !DATASOURCE_LINE {{!VAR1}} //use this instead of LOOP
TAB T=1
URL GOTO={{!COL1}}
TAB T=2
URL GOTO={{!COL2}}
SET !EXTRACTADD {{!URLCURRENT}} //VERY important: it will say if you're at the end
this is the code:
Code: Select all
var a
var i
var s
for (i=1; i<=1000; i++) //as you can see,this is a VERY HIGH range (until 1000)
{
iimSet('-var_VAR1', ''+i); //here we will set the variable VAR1 used into the macro
a = iimPlay('[[your macro name]]')
s = iimGetLastExtract();
if (s == 'chrome://browser/content/browser.xul#EANF#' || s == 'chrome://browser/content/browser.xul') break;
}
tell if it works with you.
Ciauz
p.s. since i'm only a noob, please any of the more experience users can tell me if everything is alright of if i can make any improvement? thanks
- Tech Support
- Posts: 4948
- Joined: Tue Sep 20, 2005 7:25 pm
- Contact:
Re: Loop, can Imacros tell when your at the end of file?
tampe125, that is a very clever solution
Another approach is to check the iimPlay return code: It is <0 if an error occurred (such as end of file is reached).
Another approach is to check the iimPlay return code: It is <0 if an error occurred (such as end of file is reached).
Re: Loop, can Imacros tell when your at the end of file?
i have just tried this code:
nothing happened. imacros continued to read the file..
where is the error?
Code: Select all
for (i=1; i<=60; i++)
{
iimSet('-var_VAR1', ''+i);
a = iimPlay(macro)
if (a < 0) break;
}
where is the error?
Re: Loop, can Imacros tell when your at the end of file?
Thanks tampe125 for this tip, unfortunately the xul stuff did not detect the end of my csv file...Any ideas?
Share your imacros easily http://www.sharemacro.com/imacro-directory
Internet Marketing imacros http://www.sharemacro.com
Internet Marketing imacros http://www.sharemacro.com
Re: Loop, can Imacros tell when your at the end of file?
i need a solution to this as well, but i am not sure how to intgrate js in with a macro in firefox?
Re: Loop, can Imacros tell when your at the end of file?
please emplane it