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.

Moderator: iMacros Moderators

How to determine iMacros folder locations from VBScript

by Tom, Tech Support on Tue Apr 26, 2011 4: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.iopus.com/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: 3297
Joined: Mon May 31, 2010 9:59 am

Re: How to determine iMacros folder locations from VBScript

by Tom, Tech Support on Fri May 06, 2011 7:57 am

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
Tom, Tech Support
 
Posts: 3297
Joined: Mon May 31, 2010 9:59 am


Return to How-To's and useful iMacros: All other topics

Who is online

Users browsing this forum: No registered users and 1 guest

-->