This code is totally wrong if you want to run it in iMacros
if (TextContent == "Hello World")
{
iim.Play("myMacro.iim);
}
This code is CORRECT.
var macro;
macro ="CODE:";
macro +="SET !ERRORIGNORE YES"+"\n";
macro +="TAG POS=1 TYPE=HTML ATTR=TXT:* EXTRACT=TXT"+"\n";
iimPlay(macro)
var text=iimGetLastExtract();
if(text.search("Hello World")!=-1)
{
alert("Found the text");
}
This will extract all text from the page and if there is Hello World in it, it will alert "Found the text". Also there are tons of examples on how to make iMacros JavaScript script.
Here is one on the link
Also you can't use JavaScript code in iMacros just like that. If you use
document.getElelementById("some_id").click();
just like this in the script it will not work.
But if you use it as a part of URL GOTO
command it might work in IE and earlier versions of Firefox.
URL GOTO=javascript:document.getElelementById("some_id").click();
The rule is
- First extract with iMacros
TAG
command
- Store the text in variable with
iimGetLastExtract()
- Use
search()
, match()
, indexOf()
method to find what you are looking for.