Variable Item Link

Discussions and Tech Support specific to the iMacros Firefox add-on.
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
Post Reply
User avatar
322126384
Posts: 32
Joined: Sat Jul 23, 2011 1:39 am

Variable Item Link

Post by 322126384 » Mon Aug 15, 2011 8:58 am

I am running a sript that loops a macro until a number between 1-100 is found. Here it is

Code: Select all

extracted = null
	while (extracted >=1<=100)
	{
	iimPlay("CODE: TAG POS=1 TYPE=A ATTR=HREF:/map.php?map=23")
	iimPlay("CODE: TAG POS=1 TYPE=P ATTR=TXT:Number<SP>of<SP>Spaces:<SP>* EXTRACT")
	extracted = iimGetLastExtract (extracted)
	}
But i want the number 23 to change every time the script loops the while section. how would this be possible?
-322126384
MattBell7
Posts: 627
Joined: Thu Nov 26, 2009 11:07 am
Location: United Kingdom

Re: Variable Item Link

Post by MattBell7 » Mon Aug 15, 2011 10:53 am

have a variable, start it at 1, then just add 1 to it each time you go round the loop
User avatar
322126384
Posts: 32
Joined: Sat Jul 23, 2011 1:39 am

Re: Variable Item Link

Post by 322126384 » Mon Aug 15, 2011 2:44 pm

in this case the string i want to change is a number, but what if i wanted to change between 8 different strings (up, rightup, right, rightdown, down, leftdown, left, and leftup) and after the 8th string is used, it goes back to the 1st one. how would this be accomplished and if you don't mind could you give the script included into mine (i am new to javascript and i might get even more confused). sorry i wasn't clear enough, i was in a hurry to write the post.

Thanks so much.
-322126384
MattBell7
Posts: 627
Joined: Thu Nov 26, 2009 11:07 am
Location: United Kingdom

Re: Variable Item Link

Post by MattBell7 » Tue Aug 16, 2011 10:37 am

i don't write a lot of JS, but it would be something like:

Code: Select all

extracted = null
var count=1
   while (extracted >=1<=100)
   {
   iimPlay("CODE: TAG POS=1 TYPE=A ATTR=HREF:/map.php?map=" + count)
   iimPlay("CODE: TAG POS=1 TYPE=P ATTR=TXT:Number<SP>of<SP>Spaces:<SP>* EXTRACT")
   extracted = iimGetLastExtract (extracted)
count = count+1
   }
for the other option, i would probably do this:

Code: Select all

var move=1
//do this in a loop
{
getMove(move)
//macro stuff
move = nextMove(move)
}

function nextMove(moveCode) {
moveCode=moveCode+1
if (moveCode>8){
moveCode=1
}
return moveCode
} 

function getMove(moveCode){
if (moveCode==1){
return "right"
} else if (moveCode==2){
return "left"
} else ...

}
Post Reply