Expansion of new 'How To'

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
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

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
MattBell7
Posts: 627
Joined: Thu Nov 26, 2009 11:07 am
Location: United Kingdom

Expansion of new 'How To'

Post by MattBell7 » Tue Apr 26, 2011 12:25 pm

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 (but i can't myself as i can't post in that forum)

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 oShell, ofso, wshell
Set oShell = CreateObject("WScript.Shell")
Set ofso = CreateObject("Scripting.FileSystemObject")
oShell.CurrentDirectory = oFSO.GetParentFolderName(Wscript.ScriptFullName)
set wshell = createobject("wscript.shell")

iret = iim1.iimPlay(wshell.currentdirectory&"Your Macro.iim")
iret = iim1.iimPlay(wshell.currentdirectory&"Your Next Macro.iim")
iret = iim1.iimPlay(wshell.currentdirectory&"Your Final Macro.iim")
Volodath
Posts: 23
Joined: Mon Jan 17, 2011 11:32 pm

Re: Expansion of new 'How To'

Post by Volodath » Wed Apr 27, 2011 6:42 pm

How does that affect performance when compared to just storing the script in the macro itself?

I'm not a huge nerd (just a little) and don't understand much as to the actual nuts and bolts of process usage, but it would be interesting to see what processing power usage there would be between the two.
MattBell7
Posts: 627
Joined: Thu Nov 26, 2009 11:07 am
Location: United Kingdom

Re: Expansion of new 'How To'

Post by MattBell7 » Thu Apr 28, 2011 7:19 am

i dont think it makes a difference, the reason for using the vbs is that it allows you to do things imacros doesn't, like conditionals. The only difference to having this purely in a single macro, will be the impact of the wscript.exe that runs on your machine, which is fairly minimal anyway...
Tom, Tech Support
Posts: 3834
Joined: Mon May 31, 2010 4:59 pm

Re: Expansion of new 'How To'

Post by Tom, Tech Support » Mon May 02, 2011 8:04 am

Hi Matt,

I like your suggestion, and I use this myself quite a bit, but there's an even quicker way to obtain the script path:

Code: Select all

scriptPath = Replace(WScript.ScriptFullName, WScript.ScriptName, "")
I will update the How-To with your suggestion!
Regards,

Tom, iMacros Support
User avatar
FoxDot
Posts: 20
Joined: Thu Jun 13, 2013 2:31 pm
Location: Chisinau
Contact:

Re: Expansion of new 'How To'

Post by FoxDot » Mon Sep 02, 2013 5:17 pm

Is there any way to determine iMacros folder locations using JavaScript??
The Fox Will Find You!
User avatar
FoxDot
Posts: 20
Joined: Thu Jun 13, 2013 2:31 pm
Location: Chisinau
Contact:

Re: Expansion of new 'How To'

Post by FoxDot » Tue Sep 03, 2013 3:29 pm

Actually I found a partial solution:

Code: Select all

SET !DATASOURCE Address.csv
SET !EXTRACT {{!DATASOURCE}}
PROMPT {{!EXTRACT}}
but will work only if Address.csv file is present in Datasource folder.

I know this value is stored somewhere in iMacros itself ))

It will be better and the best solution if I could extract the value from user_pref() - Firefox profile preferences :)

Code: Select all

user_pref("extensions.imacros.defdatapath", "D:\\01. iMacros\\Datasources");
The Fox Will Find You!
Tom, Tech Support
Posts: 3834
Joined: Mon May 31, 2010 4:59 pm

Re: Expansion of new 'How To'

Post by Tom, Tech Support » Wed Sep 04, 2013 11:01 am

Hi FoxDot,

You can get the location of the DataSources folder from the !FOLDER_DATASOURCE built-in variable.

You can also retrieve it using the built-in Javascript scripting interface in iMacros for Firefox with the following:

Code: Select all

imns.Pref.getFilePref("defdatapath").path
Regards,

Tom, iMacros Support
User avatar
FoxDot
Posts: 20
Joined: Thu Jun 13, 2013 2:31 pm
Location: Chisinau
Contact:

Re: Expansion of new 'How To'

Post by FoxDot » Thu Sep 05, 2013 9:28 am

Thanks Tom, this is what i was looking for:

Code: Select all

imns.Pref.getFilePref("defdatapath").path
The Fox Will Find You!
Post Reply