vendredi 6 octobre 2017

how to run different iMacros scripts in javascript with statements?

I am new to java and pretty noob. I have a problem with a script that I am trying to make for iMacros that helps me to check if some phrases from a local list are correct, if not to skip this step. If there are correct I want to save them.

The problem is that either the phrase is valid or not still saves the phrase (is blocked to if statement). If the phrase is not valid I need it to skip it and repeat step one.

This is the script

iimPlayCode("TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:phrase ATTR=NAME:text EXTRACT=HTM");
var s = iimGetLastExtract();
if (s.match("valid")) {
// Passphrase is valid >> Save
 iimPlay("test3");
} 
else {
    // Passphrase is invalid >> Re-check
     iimPlay("test");
}

test3 = imm macro (save the valid phrase) test = imm macro (check if phrase is valid)

PS: If I try to execute different codes in statements it WORKS. Like in this example if the condition is true it redirects me to facebook if not to google.

if (s.match("valid")) {
 window.location = "http://www.facebook.com";
} else {
 window.location = "http://www.google.com";
}

Aucun commentaire:

Enregistrer un commentaire