Omkar Somji
Omkar Somji

Reputation: 217

Creating dynamic folder with imacro

I have a list of URLs for which I am taking screenshots with their respective domain names,now I want these screenshots to be stored in the folders with their respective domain names, which I want to be created dynamically, so is there any way to create a folder using imacro at runtime. Following is the piece of code which I am using

var iterations = prompt("Please enter total count of URLs");
var file1 =  prompt("Please enter file name of URLs");
file1 = file1.concat(".csv");
var macro2 = "";

macro2 += "CODE:" + "\n";
macro2 += "VERSION BUILD=8920312 RECORDER=FX" + "\n";
macro2 += "SET !ERRORIGNORE YES" + "\n";
macro2 +="WAIT SECONDS=2" + "\n";
macro2 +="SET !DATASOURCE {{f1}}" + "\n";
macro2 +="SET !DATASOURCE_LINE {{i}}" + "\n";

macro2 +="SAVEAS TYPE=PNG FOLDER=C:\Users\omkar.somji\Documents\iMacros\Downloads\{{!COL1}} FILE={{!COL1}}" + "\n";

for(var i=1; i<=iterations ; i++){

iimSet('i', i );
iimSet('f1', file1 );
iimPlay(macro2);

}

Thanking you in advance.

Upvotes: 2

Views: 924

Answers (1)

Shugar
Shugar

Reputation: 5299

You can create folders "on fly" with the help of this code as an example:

var folderToCreate = "D:\\Temp\\www.domain.com";
imns.FIO.makeDirectory(folderToCreate);

(Only 'iMacros' for Firefox.)

Upvotes: 2

Related Questions