[solved] Conditional statement

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
z0om
Posts: 2
Joined: Sat Jan 25, 2014 4:34 pm

[solved] Conditional statement

Post by z0om » Sat Jan 25, 2014 4:53 pm

Hello :)

I am in trouble with conditional IF statement. My code doesn't work (line 3) :(

Code: Select all

TAB T=1
PROMPT "Buy (B) or Sell (S) :" !VAR1 "B"
SET !VAR2 EVAL("var s={{!VAR1}}; if(s == "A"){"01";} else {"02"};")
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:comm ATTR=ID:type CONTENT={{!VAR2}}
If anyone can help, it will be great !
Last edited by z0om on Sun Jan 26, 2014 2:54 am, edited 1 time in total.
siniy
Posts: 118
Joined: Sat Nov 07, 2009 7:44 pm

Re: Conditional statement

Post by siniy » Sat Jan 25, 2014 5:08 pm

Code: Select all

PROMPT "Buy (B) or Sell (S) :" !VAR1 "B"
SET !VAR2 EVAL("var s=\"{{!VAR1}}\"; if(s == \"A\"){\"01\";} else {\"02\"};")
PROMPT {{!VAR2}}
z0om
Posts: 2
Joined: Sat Jan 25, 2014 4:34 pm

Re: Conditional statement

Post by z0om » Sun Jan 26, 2014 2:52 am

Thanks a lot.

So simple, sorry :oops:
Post Reply