I try to make a simple code with JavaScript and Imacros, but I have a serious problem.
The code:
iimPlay("CODE:TAB T=1\nURL GOTO=https://www.lapatilla.com/site/\nTAG POS=1 TYPE=H4 ATTR=TXT:** EXTRACT=TXT\nPROMPT {{!EXTRACT}}");
var G_Extract= iimGetLastExtract(1);
if (G_Extract=="Estados<SP>Unidos<SP>dice<SP>en<SP>la<SP>ONU<SP>que<SP>no<SP>va<SP>a<SP>tolerar<SP>avance<SP>de<SP>Venezuela<SP>hacia<SP>una<SP>dictadura")
{
var G_Extract="CODE:";
G_Extract +="URL GOTO=lapatilla.com ";
iimPlay(G_Extract)
}
else {
var G_Prueba="CODE:";
G_Prueba +="URL GOTO=taringa.net ";
iimPlay(G_Prueba)
}
What should I do the code?
Well, in theory should go to a news portal and extract the title of the news, then in another variable compares the title extracted with another title, if the titles match run one option, otherwise run another. The problem is that it always executes as if it were else.
That is, it is as if the titles compared never match. That is a lie, there are times like the one that intentionally program in the script so that both titles match, however, that does not happen.
Can someone help me fix this?
If you look at the form your extracted text has and compare it to what you use in your IF condition, you will notice that the actual extracted text does not have any <SP>
, that's why you always enter the else.
Right now the extracted headline is
EEUU prohíbe las negociaciones de deuda nueva y capital de Venezuela y Pdvsa
and the following code succeeds in the if check, outputting IF.
iimPlay("CODE:TAB T=1\nURL GOTO=https://www.lapatilla.com/site/\nTAG POS=1 TYPE=H4 ATTR=TXT:** EXTRACT=TXT\nPROMPT {{!EXTRACT}}");
var G_Extract= iimGetLastExtract(1);
iimDisplay(G_Extract);
if (G_Extract=="EEUU prohíbe las negociaciones de deuda nueva y capital de Venezuela y Pdvsa")
{
iimDisplay("IF");
}
else {
iimDisplay("ELSE");
}