EVAL Question.

Discussions and Tech Support specific to the iMacros Firefox add-on.
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 Question.

Post by Lucas Rodrigues » Tue Oct 28, 2014 11:08 am

I want to make:
If the EXTRACT is true (have the text "5º"), then goes to URL=http://www.nabrpg.com/index.php?p=attack&bot=5, if isn't, goes to URL=http://www.nabrpg.com/index.php?p=home


Made so far:

Code: Select all

VERSION BUILD=8850919 RECORDER=FX
TAB T=1
URL GOTO=http://www.nabrpg.com/index.php?p=home
WAIT SECONDS=2
TAG POS=1 TYPE=A ATTR=TXT:Caçadas
WAIT SECONDS=2
TAG POS=1 TYPE=SELECT FORM=ACTION:?p=hunt ATTR=ID:hunt_3 CONTENT=$Ninjas<SP>Equivalentes
WAIT SECONDS=2
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:?p=hunt ATTR=ID:subm3
WAIT SECONDS=2
CLEAR
SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=B ATTR=TXT:5º EXTRACT=TXT

OS Windows 7 32 bit, Firefox 33.0, newest Imacros.
Last edited by Lucas Rodrigues on Thu Oct 30, 2014 3:35 pm, edited 1 time in total.
Snayler
Posts: 12
Joined: Wed Mar 26, 2014 2:12 pm

Re: EVAL Question.

Post by Snayler » Thu Oct 30, 2014 2:07 pm

Simple as:

Code: Select all

TAG POS=1 TYPE=B ATTR=TXT:5º EXTRACT=TXT
SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; 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}}
Lucas Rodrigues
Posts: 8
Joined: Sun Oct 26, 2014 3:04 pm

Re: EVAL Question.

Post by Lucas Rodrigues » Thu Oct 30, 2014 4:07 pm

Well, is not working, it's simply logout the game, if I give you some an accout you can try for me?


EDIT: Worked, was a mistake.
Last edited by Lucas Rodrigues on Thu Oct 30, 2014 5:15 pm, edited 1 time in total.
Snayler
Posts: 12
Joined: Wed Mar 26, 2014 2:12 pm

Re: EVAL Question.

Post by Snayler » Thu Oct 30, 2014 4:12 pm

I think I already spoon-fed you enough for today. Do your homework.
Lucas Rodrigues
Posts: 8
Joined: Sun Oct 26, 2014 3:04 pm

Re: EVAL Question.

Post by Lucas Rodrigues » Thu Oct 30, 2014 4:29 pm

Man, I'm sorry, I checked again and now is working, now I want to make that with five different situations.

TAG POS=1 TYPE=B ATTR=TXT:5º EXTRACT=TXT
SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; 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}}


This is what you give me, what I what is to make that:

Try to EXTRACT multiple words, like "1º", "2º", "3º", "4º", "5º".

If I match "1º": {url=\"http://www.nabrpg.com/index.php?p=attack&bot=1\";} else url=\"http://www.nabrpg.com/index.php?p=home\"; url;")

If I match "2º": {url=\"http://www.nabrpg.com/index.php?p=attack&bot=2\";} else url=\"http://www.nabrpg.com/index.php?p=home\"; url;")

If I match "3º": {url=\"http://www.nabrpg.com/index.php?p=attack&bot=3\";} else url=\"http://www.nabrpg.com/index.php?p=home\"; url;")

If I match "4º": {url=\"http://www.nabrpg.com/index.php?p=attack&bot=4\";} else url=\"http://www.nabrpg.com/index.php?p=home\"; url;")

If I match "5º": {url=\"http://www.nabrpg.com/index.php?p=attack&bot=5\";} else url=\"http://www.nabrpg.com/index.php?p=home\"; url;")


Is the same thing that before but with five different situations, did you undestand me?




I tried this:
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}}


But didn't work, he's going back to http://www.nabrpg.com/index.php?p=home.
Post Reply