I have a couple of iMacro-files, that is executed with a single javascript file.
Very basic, looks like this.
iimPlay("GoogleMacro.iim");
iimPlay("IBMMacro.iim");
iimPlay("IMDBMacro.iim");
iimPlay("AltavistaMacro.iim");
iimPlay("GametrailersMacro.iim");
iimPlay("MortalCombatMacro.iim");
iimPlay("WikipediaMacro.iim");
It is called playme.js, and works really good.
Though, I don't want to run every macro each time I launch the .js file.
I have a separate CSV-file, urldata.csv
URLINFO,URLINFO2,DATA1,DATA2
http://google.com,GOOGLE,"hello","thank you for searching"
http://ibm.com,IBM,null,null
http://imdb.com,IMDB,null,null
http://altavista.com,ALTAVISTA,"rip","rest in peace, my friend",
http://gametrailers.com,GAMETRAILERS,null,null
http://mortalkombat.wikia.com,MORTALKOMBAT,null,null
http://wikipedia.org,WIKIPEDIA,null,null
The way I want it to work, in this case (the data above in urldata.csv), the .js file would only execute GoogleMacro.iim and AltavistaMacro.iim
The rule I am looking for: If COL3 has the value null, do not iimPlay, and check the next file in line.
The .JS code should work (I am very aware of this is just gibberish) like this:
#Import urldata.csv
Loop whole CSV {
ROW2, If COL3 = null --> go to ROW3
else iimPlay("GoogleMacro.iim");
ROW3, If COL3 = null --> go to ROW4
else iimPlay("IBMMacro.iim");
Etc..
}
I need to figure out:
Please help! :)
Solved!
Changed the .csv to the following:
"http://google.com",GoogleMacro,"hello","thank you for searching"
"http://ibm.com",IBMMacro,"",""
"http://imdb.com",IMDBMacro,"",""
"http://altavista.com,ALTAVISTAMacro","rip","rest in peace, my friend",
"http://gametrailers.com",GAMETRAILERSMacro,"",""
"http://mortalkombat.wikia.com",MORTALKOMBATMacro,"",""
"http://wikipedia.org",WIKIPEDIAMacro,"",""
And got some really good help with the .js
var load;
load = "CODE:";
load += "SET !DATASOURCE urldata.csv" + "\n";
load += "SET !DATASOURCE_COLUMNS 4" + "\n";
load += "SET !DATASOURCE_LINE {{i}}" + "\n";
load += "SET !extract {{!col2}}" + "\n";
load += "ADD !extract {{!col3}}" + "\n";
var siteName = "";
var siteContent = "";
//Change 4 to the number of websites
for(i=1;i<4;i++) {
iimSet("i",i);
// Load data
iimPlay(load);
siteName = iimGetLastExtract(1);
// Check if the website has content
siteContent = iimGetLastExtract(2);
if(siteName != "Website" && siteContent != "") {
iimPlay(siteName + '.iim');
} else {
}
}