iMacros Script to Run Excel Macro?

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.
Post Reply
iMacrosScripter
Posts: 8
Joined: Thu Apr 27, 2017 3:10 pm

iMacros Script to Run Excel Macro?

Post by iMacrosScripter » Thu Mar 01, 2018 6:54 pm

Problem Description Information:
1. iMacros Version: iMacros for Firefox 8.9.7 (Build=8970419)
2. Windows 10 (64-bit) [English]
3. Firefox 45.9.0
4. Included demos work ok.
5. Included VBS sample scripts run ok.
6. Not applicable/no specific recording or replay fails on a specific website.
7. Not applicable/no test for encounter of the same problem with the: iMacros Browser, iMacros for Internet Explorer, iMacros for Firefox, and iMacros for Chrome.

Problem:
I am currently working on an iMacros script, and I am asking if there is a code that will allow iMacros to run an Excel macro?

For example something like:

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
WAIT SECONDS=1
TAB T=1
URL GOTO=http://*URL*/

*iMACROS CODE*

WAIT SECONDS=1
URL GOTO=imacros://run/?m=#Macro2
But instead of ending with running "Macro2" it runs an Excel macro instead; how would I do this in iMacros?

I tried the below code, and this did not work.

Code: Select all

URL GOTO=C:\Program Files\Microsoft Office\Office13\EXCEL.exe
EDIT: Progress Update
Courtesy of the wiki: http://wiki.imacros.net/URL; I was able to find the "URL GOTO=" command for running local files in Windows.

Code: Select all

URL GOTO=file:///C:\Directory\TEST.CSV
As a result, I was able initiate the running of an Excel (.CSV) file where the "URL GOTO=" triggers the browser prompt window below. How would I code iMacros to open the local file, and not download it?
Image
Attachments
DIALOG WINDOW (JPEG).jpg
chivracq
Posts: 7971
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: iMacros Script to Run Excel Macro?

Post by chivracq » Sat Mar 03, 2018 1:47 am

iMacroScripter wrote:Problem Description Information:
1. iMacros Version: iMacros for Firefox 8.9.7 (Build=8970419)
2. Windows 10 (64-bit) [English]
3. Firefox 45.9.0
4. Included demos work ok.
5. Included VBS sample scripts run ok.
6. Not applicable/no specific recording or replay fails on a specific website.
7. Not applicable/no test for encounter of the same problem with the: iMacros Browser, iMacros for Internet Explorer, iMacros for Firefox, and iMacros for Chrome.

Problem:
I am currently working on an iMacros script, and I am asking if there is a code that will allow iMacros to run an Excel macro?

For example something like:

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
WAIT SECONDS=1
TAB T=1
URL GOTO=http://*URL*/

*iMACROS CODE*

WAIT SECONDS=1
URL GOTO=imacros://run/?m=#Macro2
But instead of ending with running "Macro2" it runs an Excel macro instead; how would I do this in iMacros?

I tried the below code, and this did not work.

Code: Select all

URL GOTO=C:\Program Files\Microsoft Office\Office13\EXCEL.exe
iMacroScripter wrote:EDIT: Progress Update
Courtesy of the wiki: http://wiki.imacros.net/URL; I was able to find the "URL GOTO=" command for running local files in Windows.

Code: Select all

URL GOTO=file:///C:\Directory\TEST.CSV
As a result, I was able initiate the running of an Excel (.CSV) file where the "URL GOTO=" triggers the browser prompt window below. How would I code iMacros to open the local file, and not download it?
Image
Hum..., try to select the correct Sub-Forum when you open a Thread, this one has nothing to do with 'Data Extraction' and will be moved... one day... by the Forum Admin to the 'General' one where it belongs... (But no need to duplicate now...) :roll:

Hum, I've already mentioned it's better to post an Update in your Thread as you "progress" rather than editing your OP... You are "lucky" I still wanted to reply in this Thread, or I wouldn't have noticed your Edit... :roll:

And I give up asking to upload your Screenshots directly to the Forum rather than on some external Image Hosting Server as those Sites nearly always stop to exist after a few years or even months or they go commercial or they clean up "older" Images after a while, and your Screenshots will disappear... :roll:

>>>

OK, concerning this one, yeah..., you found the 'URL GOTO=file:///' Syntax to open Local Files (in a Tab) in the Browser, but it only works for '.TXT'/'.HTM(L)'/'.LOG'/etc Files and not for Executables like '.EXE' or '.BAT'. And for '.CSV'/'.XLS'/'.PDF' Files you indeed have to deal with the "Automatically open"/"Always ask" Mechanism for "known" Extensions that some external Programs want to handle, like you had already found out in your very first Thread and here again...

There are several Solutions anyway... :D

1- You mention each time you open a Thread "Included VBS sample scripts run ok." meaning you must be using or can use the Scripting Interface (I've already asked you which Version...?, but you didn't answer and still don't mention that in your FCI). That would be the most straightforward and more "powerful" Solution...! Have a main '.vbs' Script calling an (on-the-fly) '.iim' Macro for the 'iMacros'/Web-Automation part and let the '.vbs' Script handle the Excel/'.CVS' Macro part as you then have Full Control on Excel from your '.vbs' Script.

2- Another Solution as you are on FF is to use some extra FF Add-on called 'External Applications Button' from which you can launch from one Click in FF '.EXE'/'.BAT' Files, or even '.TXT' Files. Each Program or File you want to launch can be assigned a Shortcut that iMacros in an '.iim' Script is able to trigger using the 'EVENT' Mode.

3- And since a few months, some Syntax is "circulating" on the Forum and on SOF (came from SOF originally I would think...) about how to launch a Local File (any Extension, so it works for '.EXE'/'.BAT'/etc...) in "pure" JavaScript, and therefore from a '.js' Script with iMacros for FF.

The first time I saw it was in this Thread, and I then "vaguely" tried at that time to convert it to be able able to use it "directly" from an '.iim' Script (as I don't use '.js' Scripts myself), but I didn't succeed directly in my "quick and dirty" Tries/Testing, and I didn't really need that Functionality for myself, so I didn't really insist to get it to work in pure '.iim'.
Have a look at that Thread for the Syntax, and what I had tried... :idea:
Some other User revived the Thread a few months later but they didn't follow up (hum..., one more...! :wink: ), so I didn't bother digging into that Matter again either, ah-ah...! :wink:

And hum, "mini-Detail" but both Options '2-' and '3-' assume that when starting 'Excel' from the Command Line ('.BAT' File or Windows Shortcut), you can pass a specific 'Excel' ('.XLS'/'.CSV') File as Argument together with a Macro or that the Macro can start automatically when opening a File in 'Excel', or same thing when launching a File associated with 'Excel', to pass the Name of the Macro as Argument/Parameter...
I don't know about that, YOU are the '.vbs'/'Excel' Specialist, ah-ah...! :wink:
But, well..., even if not possible from the Command Line, then you could include that Functionality in some mini '.vbs' Script, ah-ah...!
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
Posts: 7971
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: iMacros Script to Run Excel Macro?

Post by chivracq » Sat Mar 03, 2018 2:13 pm

Hum..., and I can think of a few other ways to achieve the same "Result" I guess...
No idea what your Excel Macro will be doing, some Data Manipulation/Calculation I reckon, and if your '.CSV' will come from an iMacros 'SAVEAS' or if you "already have it" and maybe use it as DataSource for some iMacros Script, but there are other ways to do some Data Manipulation/Calculation than Excel...!, and yep, "directly" from an iMacros (.iim) Script...

For "very simple/basic" Manipulation, you can open your File as a '.TXT' File (and not '.CSV' or you'll hit again the 'Ask always' Popup) in a 2nd Tab in your Browser with the 'URL GOTO=file:///' Syntax, extract the whole Content of the File/Page ('TYPE=PRE'), do your Data Manipulation with 'EVAL()' and resave the Page/File with 'SAVEAS'.
The 'EVAL()' can be a bit cumbersome (especially locating the Data that you want to use or modify for the Manipulation), so that's doable for some "basic" Stuff, I would say... Hum, well, "basic-basic"..., you can do complex "Things" with it as well if you want or course, but it's "easy" to make Mistakes...

And for a bit more complex Calculations, you can use a GoogleSheet instead of your '.CSV', and let your '.iim' Macro do the Calculations/Edits/Inserts, or you can combine a GoogleForm for the Excel Macro part... :idea:
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
Post Reply