How to determine iMacros folder locations from VBScript

Share your tips, tricks and favorite iMacros macros, scripts and applications for web automation in general here.
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 VBScript

Post by Tom, Tech Support » Tue Apr 26, 2011 11:15 am

Have you ever wanted to be able to reference the various iMacros folders from your script? Did you know that with iMacros 7, the default folder locations are specified in the Windows Registry?

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

Code: Select all

Function GetiMacrosFolder(folderName)
	' Valid values for folderName are: Macros, DataSources, Downloads, and Logs.
	Dim WshShell
	Set WshShell = CreateObject("WScript.Shell")
	GetiMacrosFolder = WshShell.RegRead("HKEY_CURRENT_USER\Software\iOpus\iMacros\Folder" & folderName)
End Function
UPDATE:
MattBell7 wrote:Just seen the How to Tom just posted, http://forum.imacros.net/viewtopic.php?f=6&t=12790, and figured it may be worth adding this to it.

Using this code, you can tell your vbs to run your macro from a dynamic location. i.e. the same folder as the vbs, regardless of where iMacros is configured to use. This is especially useful if you move your macros around a lot between different folder structures, or if they're used by many people with slightly different configurations.

Code: Select all

Dim iim1, iret
'initialize iMacros instance
set iim1 = CreateObject ("imacros")

Dim scriptPath
scriptPath = Replace(WScript.ScriptFullName, WScript.ScriptName, "")

iret = iim1.iimPlay(scriptPath & "Your Macro.iim")
iret = iim1.iimPlay(scriptPath & "Your Next Macro.iim")
iret = iim1.iimPlay(scriptPath & Your Final Macro.iim")
See this post for more discussion.
Regards,

Tom, iMacros Support
Tom, Tech Support
Posts: 3834
Joined: Mon May 31, 2010 4:59 pm

Re: How to determine iMacros folder locations from VBScript

Post by Tom, Tech Support » Fri May 06, 2011 2:57 pm

In iMacros 7, you have programmatic control of the path settings by the following means:
  • Macro Folder: Specify the macro path and file name via iimPlay().
  • Downloads Folder: Specify the download path using the FOLDER parameter of the ONDOWNLOAD and SAVEAS commands.
  • DataSources Folder: Use SET !FOLDER_DATASOURCE to specify the folder containing input files.
  • Performance Log Folder: Use SET !FOLDER_STOPWATCH to specify the folder location for the file that contains the measurement data created with the STOPWATCH command.
Regards,

Tom, iMacros Support
Post Reply