Repeat only a part of macro HELP ME

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
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
Post Reply
provoquestosito
Posts: 75
Joined: Sat Jan 30, 2010 12:43 am

Repeat only a part of macro HELP ME

Post by provoquestosito » Sat Jan 30, 2010 3:43 pm

Hello

i need to repeat a part of macro.

I need to repeat second part of my macro

Code: Select all

SET !ERRORIGNORE YES
SET !LOADCHECK YES
SET !REPLAYSPEED FAST
SET !POINTER YES
SET !TIMEOUT 120
SET !TIMEOUT_TAG 3 


'//// DO NOT REPEAT /////
'//// DO NOT REPEAT /////
'/// LOGIN ///
TAB T=1
URL GOTO=*
FRAME F=0
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:*/connect.php ATTR=NAME:login CONTENT=
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ACTION:*/connect.php ATTR=NAME:password CONTENT=
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:*/connect.php ATTR=VALUE:Connexion
TAB T=1
TAB CLOSEALLOTHERS 
TAB OPEN
TAB T=2
URL GOTO=*
WAIT SECONDS=2
TAB T=1
TAB CLOSEALLOTHERS 
'/// LOGIN ///
'//// DO NOT REPEAT /////
'//// DO NOT REPEAT /////




'//// MUST REPEAT 50 CICLES////
'//// MUST REPEAT 50 CICLES////
'/// PTC ///
TAB T=1
URL GOTO=*
FRAME F=0
TAG POS=1 TYPE=* ATTR=HREF:#
TAB T=1
TAB CLOSEALLOTHERS 
'/// PTC ///
'//// MUST REPEAT 50 CICLES////
'//// MUST REPEAT 50 CICLES////

Can you help me to set a correct loop in second part of macro ?

I want not to copy 50 parts of my macro, i want to set a loop function in a part of my macro.


Sincerely
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: Repeat only a part of macro HELP ME

Post by Daniel, Tech Support » Mon Feb 01, 2010 2:17 pm

Hello,

There are two ways to solve this issue:

1. You can create 2 macro: one with the static part and another one that should be repeated. In order to repeat you macros the desired amount of times, use the "Play (Loop)" button. You can also make use of the !LOOP variable, here is more information about that: http://wiki.imacros.net/LOOP
2. You can create a VBScript or a JavaScript that does the work. You can find more information and a VBScript example of this here: http://wiki.imacros.net/Loop_after_Query_or_Login. Note however, that you can only use Javascript with our Firefox plugin.

Hope that this helps. Should you need further assistance, please let don't hesitate to ask. A sample of your code would help us to come up with a more specific solution.
Daniel, iOpus Support
provoquestosito
Posts: 75
Joined: Sat Jan 30, 2010 12:43 am

Re: Repeat only a part of macro HELP ME

Post by provoquestosito » Tue Feb 02, 2010 5:39 pm

Hello

I do not understand the page

Can you write a simple example here

Many thanks

sincerely
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: Repeat only a part of macro HELP ME

Post by Daniel, Tech Support » Tue Feb 02, 2010 6:10 pm

Yes, please:

Code: Select all

var macro, iret;

function FirstMacro()
{
	macro = "CODE:";
	macro += "VERSION BUILD=6311226 RECORDER=FX\n";
	macro += "URL GOTO=http://www.google.com/#hl=en&source=hp&q=iMacros&aq=f&aqi=g10&oq=&fp=822b7b8219bb38af\n";
	iret = iimPlay(macro)
}

function SecondMacro()
{
	macro = "CODE:";
	macro += "VERSION BUILD=6311226 RECORDER=FX\n";
	macro = macro + "TAG POS=1 TYPE=A ATTR=TXT:*Next\n"
	iret = iimPlay(macro)
}

FirstMacro();

for(i=0; i<50; i++)
{
	SecondMacro();
}
The firsy part execute ones and the second 50 times in a loop.
Daniel, iOpus Support
aviheaven
Posts: 9
Joined: Fri Dec 30, 2016 7:53 pm
Contact:

Re: Repeat only a part of macro HELP ME

Post by aviheaven » Sat Dec 31, 2016 10:43 pm

Repeat only 2 part of macro HELP ME
Post Reply