My desktop is GNU/Linux debian testing, Firefox 45.9.0 and iMacros for Firefox 8.9.7.
I'm new in Imacros and I'm trying to extract -as a trainning- the data from a table on a website and different tabs. I have encountered a problem with EXTRACT command combined with iimGetLastExtract(n).
The code can extract (PROMPT {{!EXTRACT}} show value) data and save in .csv file, but iimGetLastExtract(n) only read null value for all data extracted, and the javascript logical operator's code doens't work. But, if I insert SET !EXTRACTDIALOG YES javascript works fine but doens't save data in .csv file.
Code: Select all
// Carga del website
var macro1 = "CODE:";
macro1 += "TAB T=1\n";
macro1 += "URL GOTO=http://es.global-rates.com/estadisticas-economicas/inflacion/indice-de-precios-al-consumo/ipc/ipc.aspx\n";
macro1 += "SET !TIMEOUT_STEP 1\n";
// Extracción de datos
var macro2 = "CODE:";
macro2 += "SET !TIMEOUT_STEP 1\n";
macro2 += "TAG POS=1 TYPE=TD ATTR=TXT:{{i}} EXTRACT=TXT\n";
macro2 += "TAG POS=R1 TYPE=TD ATTR=TXT:* EXTRACT=TXT\n";
macro2 += "TAG POS=R2 TYPE=TD ATTR=TXT:* EXTRACT=TXT\n";
macro2 += "SET !EXTRACTDIALOG YES\n";
macro2 += "SAVEAS TYPE=EXTRACT FOLDER=* FILE=VISORD_o.csv\n";
// Ir a nueva URL
var macro3 = "CODE:";
macro3 += "TAB OPEN NEW\n";
macro3 += "TAB T=2\n";
macro3 += "URL GOTO=http://www.google.com \n";
macro3 += "TAG POS=2 TYPE=DIV ATTR=TXT:Google.es* EXTRACT=TXT\n";
macro3 += "SAVEAS TYPE=EXTRACT FOLDER=* FILE=VISORD_o.csv\n";
macro3 += "TAB T=1\n";
macro3 += "TAB CLOSEALLOTHERS\n";
for (l=1;l<2;l++)
{
iimPlay(macro1);
for (n=1;n<8;n++)
{
var i = ["Alemania","Austria","Brasil","Corea del Sur","Dimamarca","Eslovaquia","Japón"];
iimSet("i",i[n-1]);
iimPlay(macro2);
var date = iimGetLastExtract(2);
//alert(date);
if (date == 'mayo 2017')
{
iimPlay(macro3);
}
}
}
Would someone be able to have a look at this and see what I'm doing wrong? Many thanks for your time and efforts.