How to determine iMacros folder locations from Javascript

Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team
Post Reply
Tom, Tech Support
Posts: 3834
Joined: Mon May 31, 2010 4:59 pm

How to determine iMacros folder locations from Javascript

Post by Tom, Tech Support » Fri Jun 07, 2013 12:32 pm

Have you ever wanted to be able to reference the various iMacros folders from your script?

You can add the following function to your Javascript code to easily retrieve these folder locations:

Code: Select all

function getiMacrosFolder(folderName)
{
	var pname;
	switch (folderName)
	{
		case "Macros" :
			pname = "defsavepath";
			break;
		case "DataSources" :
			pname = "defdatapath";
			break;
		case "Downloads" :
			pname = "defdownpath";
			break;
		case "Logs" :
			pname = "deflogpath";
			break;
		default :
			throw folderName + " is not a valid iMacros folder name";
			break;
	}
	return imns.Pref.getFilePref(pname).path;
}
Just pass in the name of the folder to retrieve the full path, for example:

Code: Select all

var downloadFolder = getiMacrosFolder("Downloads");
Regards,

Tom, iMacros Support
Post Reply