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:
- How to import/read the data from urldata.csv to my playme.js. Apparently, jQuery is not allowed in the free version of iMacros and therefore I cannot use this.
- How to make a function that only use iiPlay if the value on row X is something else than null.
Please help! :)
Make a GET request to get the contents of your CSV file (jQuery might help with that), then use a CSV parser (maybe https://stackoverflow.com/a/14991797/711902) to parse the file, then loop through each row, and call the function if it matches your expectation.
Solved!
Changed the .csv to the following:
And got some really good help with the .js