iMacro If Else Statement without Javascript

Chozo Qhai picture Chozo Qhai · Oct 31, 2013 · Viewed 23.3k times · Source

I currently make a iMacro script that use ImageSearch to find the image and perform other function. If the image1 match imagesearch then perform task1, else if perform task2.

If IMAGESEARCH POS=1 IMAGE=IMAGE1.png CONFIDENCE=65
   TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:bet-amount CONTENT=0.01
   TAG POS=1 TYPE=BUTTON:SUBMIT ATTR=ID:bet-bt

Else If IMAGESEARCH POS=1 IMAGE=IMAGE2.png CONFIDENCE=65
   TAG POS=1 TYPE=BUTTON:SUBMIT ATTR=ID:bet-multiplier
   TAG POS=1 TYPE=BUTTON:SUBMIT ATTR=ID:bet-bt

How can I make the if statement ?

Answer

macroscripts picture macroscripts · Oct 31, 2013

You have to use JavaScript scripting. You have an example here

Loop in Imacros using Javascript

In your case this would be first macro

IMAGESEARCH POS=1 IMAGE=IMAGE1.png CONFIDENCE=65

This would be second macro

IMAGESEARCH POS=1 IMAGE=IMAGE2.png CONFIDENCE=65

This would be third macro.

   TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:bet-amount CONTENT=0.01
   TAG POS=1 TYPE=BUTTON:SUBMIT ATTR=ID:bet-bt

And this would be fourth macro.

TAG POS=1 TYPE=BUTTON:SUBMIT ATTR=ID:bet-multiplier
   TAG POS=1 TYPE=BUTTON:SUBMIT ATTR=ID:bet-bt

So this is how it's supposed to look like.

if(iimPlay(macro1)>0)
{
iimPlay(macro3)
}
else if(iimPlay(macro2)>0)
{
iimPlay(macro4)
}