EVAL/ EXTRACT/ if match

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
Lucas Rodrigues
Posts: 8
Joined: Sun Oct 26, 2014 3:04 pm

EVAL/ EXTRACT/ if match

Post by Lucas Rodrigues » Thu Oct 30, 2014 5:23 pm

I'm tryng to search for multiple words: 1º, 2º, 3º, 4º, 5º, if I found one of them I want to go to http://www.nabrpg.com/index.php?p=attack&bot=1//2/3/4/5 << the right number depends of the word founded, example:

If I found 1º, go to http://www.nabrpg.com/index.php?p=attack&bot=1
If I found 2º, go to http://www.nabrpg.com/index.php?p=attack&bot=2

This is working with only 1 word founded, but not with multiple words and URL's, example:

Code: Select all

SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; if(s.match(\"1º\")){url=\"http://www.nabrpg.com/index.php?p=attack&bot=1\";} else url=\"http://www.nabrpg.com/index.php?p=home\"; url;")

What I tried so far:

Code: Select all

VERSION BUILD=8850919 RECORDER=FX
TAB T=1
URL GOTO=http://www.nabrpg.com/index.php?p=home
URL GOTO=http://www.nabrpg.com/index.php?p=hunt
TAG POS=1 TYPE=SELECT FORM=ACTION:?p=hunt ATTR=ID:hunt_3 CONTENT=$Ninjas<SP>Equivalentes
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:?p=hunt ATTR=ID:subm3
SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=B ATTR=TXT:1º EXTRACT=TXT
TAG POS=1 TYPE=B ATTR=TXT:2º EXTRACT=TXT
TAG POS=1 TYPE=B ATTR=TXT:3º EXTRACT=TXT
TAG POS=1 TYPE=B ATTR=TXT:4º EXTRACT=TXT
TAG POS=1 TYPE=B ATTR=TXT:5º EXTRACT=TXT
SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; if(s.match(\"1º\")){url=\"http://www.nabrpg.com/index.php?p=attack&bot=1\";} if(s.match(\"2º\")){url=\"http://www.nabrpg.com/index.php?p=attack&bot=2\";} if(s.match(\"3º\")){url=\"http://www.nabrpg.com/index.php?p=attack&bot=3\";} if(s.match(\"4º\")){url=\"http://www.nabrpg.com/index.php?p=attack&bot=4\";} if(s.match(\"5º\")){url=\"http://www.nabrpg.com/index.php?p=attack&bot=5\";} else url=\"http://www.nabrpg.com/index.php?p=home\"; url;")
URL GOTO={{!VAR1}}
Worked until the EXTRACT of them.
After this is going to http://www.nabrpg.com/index.php?p=home, instead of the URL of the match.
Post Reply