If/Else conditional statement help!

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
n00bGT
Posts: 3
Joined: Sun Dec 20, 2009 4:51 pm

If/Else conditional statement help!

Post by n00bGT » Thu Dec 12, 2013 7:00 pm

So I'm trying to add an if/else conditional statement in my .js file
What I'm trying to accomplish is if it finds the word "In Battle!" anywhere on the page to run a certain macro.

This is what I have now,

Code: Select all

iimPlay("CODE:TAB T=1\nURL GOTO=www.InsertLinkhere.com\nTAG POS=1 TYPE=A ATTR=TXT:In<SP>battle!* EXTRACT=TXT");
var G_Extract=iimGetLastExtract(1);
if (G_Extract=="In<SP>Battle!*")
{
iimPlay ("Battle.iim")
}
else
  {
  iimPlay ("Fail.iim")
  }
Any help would be appreciated!
If you got questions or need me to further explain, Let me know!
User avatar
bobis
Posts: 364
Joined: Sat Sep 11, 2010 3:34 pm
Contact:

Re: If/Else conditional statement help!

Post by bobis » Sun Dec 15, 2013 6:09 pm

your IF statement comparison is incorrect (in JavaScript no need to set <sp> and wildcard * won't work) try this:

Code: Select all

if (trim(G_Extract)=="In Battle!")
Get Best iMacros scripts at http://imacrosbot.com/
Post Reply