ondownload alternative

Discussions and Tech Support specific to the iMacros Firefox add-on.
Forum rules
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
mshamblin
Posts: 6
Joined: Mon Aug 14, 2017 4:27 pm

ondownload alternative

Post by mshamblin » Mon Jan 11, 2021 11:57 pm

Greetings

Imacros Enterprise Version 10.1.25.8883
Current iMacros for firefox v8.9.7 (soon to be 10.0.2)
Firefox v56.0 (soon to be 84.0.2)
Windows 10 pro

My company was purchased and the new owners are requiring we upgrade firefox. As you know the ondownload will no longer work with newer versions. We are searching for a workaround or another way to download files using the most up to date firefox and imacros for firefox. We have around 250 different macros that we run on real estate software to download approx 900 .txt and .csv files daily. We do not care where the files are downloaded as long as we can either rename them before or after the download, each of the 900+ files must be named differently.

We have 8 different types of websites we have to access so each site has a different process.
Here are two samples of the code we currently use for the download process:

1.
TAG POS=2 TYPE=SPAN ATTR=TXT:Results
WAIT SECONDS=5
TAG POS=1 TYPE=A ATTR=ID:m_lnkCheckAllLink
TAG POS=1 TYPE=SPAN ATTR=TXT:Export
ADD !VAR2 1
TAG POS=1 TYPE=SELECT FORM=ID:Export ATTR=ID:m_ddExport CONTENT=%ud69924
ONDOWNLOAD FOLDER=Z:\archive\fl_miami\{{!NOW:yyyymmdd}} FILE=fl_miami_all_all_{{!NOW:yyyymmdd}}_00{{!VAR2}}.csv WAIT=NO
TAG POS=1 TYPE=A ATTR=ID:m_btnExport
TAG POS=1 TYPE=SPAN ATTR=TXT:Back<SP>to<SP>Results
TAG POS=2 TYPE=SPAN ATTR=TXT:Criteria

2.
TAG POS=1 TYPE=BUTTON ATTR=ID:Search
WAIT SECONDS=5
FRAME NAME="tab2_1_2"
TAG POS=1 TYPE=A ATTR=ID:Export
TAG POS=1 TYPE=A ATTR=ID:ExportCSV
FRAME F=0
WAIT SECONDS=5
TAG POS=1 TYPE=BUTTON ATTR=ID:Export
SET !VAR2 0
ADD !VAR2 1
ONDOWNLOAD FOLDER=Z:\archive\tx_tar\{{!NOW:yyyymmdd}} FILE=tx_tar_all_all_{{!NOW:yyyymmdd}}_00{{!VAR2}}.csv WAIT=YES
WAIT SECONDS=5
TAB T=1
TAG POS=2 TYPE=EM ATTR=TXT:[x]


Thanks,
M
chivracq
Posts: 9716
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: ondownload alternative

Post by chivracq » Tue Jan 12, 2021 12:47 am

mshamblin wrote:
Mon Jan 11, 2021 11:57 pm
Greetings

Code: Select all

Imacros Enterprise Version 10.1.25.8883 
Current iMacros for firefox v8.9.7 (soon to be 10.0.2)
Firefox v56.0 (soon to be 84.0.2)
Windows 10 pro
My company was purchased and the new owners are requiring we upgrade firefox. As you know the ondownload will no longer work with newer versions. We are searching for a workaround or another way to download files using the most up to date firefox and imacros for firefox. We have around 250 different macros that we run on real estate software to download approx 900 .txt and .csv files daily. We do not care where the files are downloaded as long as we can either rename them before or after the download, each of the 900+ files must be named differently.

We have 8 different types of websites we have to access so each site has a different process.
Here are two samples of the code we currently use for the download process:

1.

Code: Select all

TAG POS=2 TYPE=SPAN ATTR=TXT:Results
WAIT SECONDS=5
TAG POS=1 TYPE=A ATTR=ID:m_lnkCheckAllLink
TAG POS=1 TYPE=SPAN ATTR=TXT:Export
ADD !VAR2 1
TAG POS=1 TYPE=SELECT FORM=ID:Export ATTR=ID:m_ddExport CONTENT=%ud69924
ONDOWNLOAD FOLDER=Z:\archive\fl_miami\{{!NOW:yyyymmdd}} FILE=fl_miami_all_all_{{!NOW:yyyymmdd}}_00{{!VAR2}}.csv WAIT=NO
TAG POS=1 TYPE=A ATTR=ID:m_btnExport
TAG POS=1 TYPE=SPAN ATTR=TXT:Back<SP>to<SP>Results
TAG POS=2 TYPE=SPAN ATTR=TXT:Criteria
2.

Code: Select all

TAG POS=1 TYPE=BUTTON ATTR=ID:Search
WAIT SECONDS=5
FRAME NAME="tab2_1_2"
TAG POS=1 TYPE=A ATTR=ID:Export
TAG POS=1 TYPE=A ATTR=ID:ExportCSV
FRAME F=0
WAIT SECONDS=5
TAG POS=1 TYPE=BUTTON ATTR=ID:Export
SET !VAR2 0
ADD !VAR2 1
ONDOWNLOAD FOLDER=Z:\archive\tx_tar\{{!NOW:yyyymmdd}} FILE=tx_tar_all_all_{{!NOW:yyyymmdd}}_00{{!VAR2}}.csv WAIT=YES
WAIT SECONDS=5
TAB T=1
TAG POS=2 TYPE=EM ATTR=TXT:[x]

Thanks,
M

Alright, mini-Compliment on the "Good Quality" for your OP, ah-ah...! :D

But I'm not sure what you mean with "As you know the ondownload will no longer work with newer versions. [on FF]", in iMacros for FF v10.0.2, File Upload is indeed not supported, but File Download is...!, and the 'ONDOWNLOAD' Command still works in that Version afaik...

What does play a "Role", is that that Command indeed needs the FIO-Module for Local File-Access for the 'FOLDER' + 'FILE' Params to be supported to be able to rename the downloaded File instead of using the Default Filename from the Web-Server...
And you only get the FIO-Module with a 'PE' / 'Pro' / 'Enterprise' License, not with the 'Free' Version for iMacros v10.x for FF/CR.
(But the 'Free' Version is also only "meant" to be "Free" for Home Users anyway, Company Users are "expected" to be using a 'PE' License (or higher)...)

So I would expect your Scripts to keep working in 10.0.2 for FF 'PE' with the FIO-Module installed. 8)

Another Alternative (next to using iMacros for CR v10.1.0), or iMB v12.6, if you want to keep using v8.9.7 for FF, that Version also works on "modern" Browsers forked on FF but that didn't adopt the 'WebExtensions' Architecture, like 'Pale Moon' (PM28) or 'Basilisk' and 'WaterFox' (v2020/v2021)... And those Browsers get regular Security Updates... :idea:

I'll ping @TechSup anyway if they want to have a look at your Thread and confirm if what I mentioned about 'ONDOWNLOAD' for v10.0.2 for FF is correct...
Last edited by chivracq on Tue Jan 12, 2021 4:37 am, edited 1 time in total.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
mshamblin
Posts: 6
Joined: Mon Aug 14, 2017 4:27 pm

Re: ondownload alternative

Post by mshamblin » Tue Jan 12, 2021 4:16 am

Alright, mini-Compliment on the "Good Quality" for your OP, ah-ah...! :D

I appreciate it!
But I'm not sure what you mean with "As you know the ondownload will no longer work with newer versions. [on FF]", in iMacros for FF v10.0.2, File Upload is indeed not supported, but File Download is...!, and the 'ONDOWNLOAD' Command still works in that Version afaik...
I thought that the ONDOWNLOAD command stopped working after FF version 56.
What does play a "Role", is that that Command indeed needs the FIO-Module for Local File-Access for the 'FOLDER' + 'FILE' Params to be supported to be able to rename the downloaded File instead of using the Default Filename from the Web-Server...
And you only get the FIO-Module with a 'PE' / 'Pro' / 'Enterprise' License, not with the 'Free' Version for iMacros v10.x for FF/CR.
(But the 'Free' Version is also only "meant" to be "Free" for Home Users anyway, Company Users are "expected" to be using a 'PE' License (or higher)...)
We have the Enterprise version. When you say FIO-Module are you referring to the File Access Module? If so, we have that installed.

Another Alternative (next to using iMacros for CR v10.1.0), or iMB v12.6, if you want to keep using v8.9.7 for FF, that Version also works on 'modern" Browsers forked on FF but that didn't adopt the 'WebExtensions' Architecture, like 'Pale Moon' (PM28) or 'Basilisk' and 'WaterFox' (v2020/v2021)... And those Browsers get regular Security Updates... :idea:


I will keep that in mind but more than likely not something the new company would like for us to do.

We upgraded and are trying to get the macros to get to the point of being able to use the ondownload command but now we are stuck with the "MacroError: Missing host permission for the tab". So off to try to figure that out.

I appreciate your help!

M
Tom, Tech Support
Posts: 3681
Joined: Mon May 31, 2010 4:59 pm

Re: ondownload alternative

Post by Tom, Tech Support » Thu Jan 14, 2021 9:44 am

chivracq wrote:
Tue Jan 12, 2021 12:47 am
I'll ping @TechSup anyway if they want to have a look at your Thread and confirm if what I mentioned about 'ONDOWNLOAD' for v10.0.2 for FF is correct...
Yes, ONDOWNLOAD is supported in the latest version of iMacros for Firefox. Uploading files, however, currently is not supported.
Regards,

Tom, iMacros Support
mshamblin
Posts: 6
Joined: Mon Aug 14, 2017 4:27 pm

Re: ondownload alternative

Post by mshamblin » Thu Jan 14, 2021 11:16 pm

Tom, Tech Support wrote:
Thu Jan 14, 2021 9:44 am
chivracq wrote:
Tue Jan 12, 2021 12:47 am
I'll ping @TechSup anyway if they want to have a look at your Thread and confirm if what I mentioned about 'ONDOWNLOAD' for v10.0.2 for FF is correct...
Yes, ONDOWNLOAD is supported in the latest version of iMacros for Firefox. Uploading files, however, currently is not supported.
Thanks Tom

We have upgraded to ff 84 with iMacros 10.0.2.1450 and we do have the FIO-Module and we are having problems saving the files from the save dialog box. This works perfectly in FF 56 with Imacros 8.9.7. We have tried all we know to get it to save the file. What am I missing?? It does not give any errors it just stops at the ondownload command. The save dialog box pops up as normal but it just sits there.
Thanks,
Mike

URL GOTO=https://yuma.paragonrels.com/ParagonLS/Default.mvc
TAG POS=1 TYPE=SPAN ATTR=ID:search-nav
TAG POS=1 TYPE=A ATTR=TXT:Saved<SP>Property<SP>Searches
WAIT SECONDS=1
FRAME F=9
TAG POS=1 TYPE=A ATTR=TXT:CA_RNT
WAIT SECONDS=3
FRAME F=10
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/ParagonLS/Search/Property.mvc/Search/6 ATTR=ID:f_621_Low CONTENT=01/21/2019
TAG POS=1 TYPE=BUTTON ATTR=ID:Search
WAIT SECONDS=7
FRAME F=12
TAG POS=1 TYPE=A ATTR=TXT:Export<SP>»
WAIT SECONDS=2
TAG POS=1 TYPE=A ATTR=TXT:Export<SP>to<SP>CSV
WAIT SECONDS=3
SET !VAR2 0
ADD !VAR2 1
ONDOWNLOAD FOLDER=Z:\archive\az_yuma\{{!NOW:yyyymmdd}} FILE=az_yuma_all_all_{{!NOW:yyyymmdd}}_00{{!VAR2}}.csv WAIT=YES
FRAME F=0
TAG POS=1 TYPE=BUTTON ATTR=ID:Export
WAIT SECONDS=10
TAB T=1
TAG POS=1 TYPE=SPAN ATTR=TXT:Criteria
chivracq
Posts: 9716
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: ondownload alternative

Post by chivracq » Thu Jan 14, 2021 11:42 pm

mshamblin wrote:
Thu Jan 14, 2021 11:16 pm
Thanks Tom

We have upgraded to ff 84 with iMacros 10.0.2.1450 and we do have the FIO-Module and we are having problems saving the files from the save dialog box. This works perfectly in FF 56 with Imacros 8.9.7. We have tried all we know to get it to save the file. What am I missing?? It does not give any errors it just stops at the ondownload command. The save dialog box pops up as normal but it just sits there.
Thanks,
Mike

Code: Select all

URL GOTO=https://yuma.paragonrels.com/ParagonLS/Default.mvc
TAG POS=1 TYPE=SPAN ATTR=ID:search-nav
TAG POS=1 TYPE=A ATTR=TXT:Saved<SP>Property<SP>Searches
WAIT SECONDS=1
FRAME F=9
TAG POS=1 TYPE=A ATTR=TXT:CA_RNT
WAIT SECONDS=3
FRAME F=10
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/ParagonLS/Search/Property.mvc/Search/6 ATTR=ID:f_621_Low CONTENT=01/21/2019
TAG POS=1 TYPE=BUTTON ATTR=ID:Search
WAIT SECONDS=7
FRAME F=12
TAG POS=1 TYPE=A ATTR=TXT:Export<SP>»
WAIT SECONDS=2 
TAG POS=1 TYPE=A ATTR=TXT:Export<SP>to<SP>CSV
WAIT SECONDS=3
SET !VAR2 0
ADD !VAR2 1
ONDOWNLOAD FOLDER=Z:\archive\az_yuma\{{!NOW:yyyymmdd}} FILE=az_yuma_all_all_{{!NOW:yyyymmdd}}_00{{!VAR2}}.csv WAIT=YES
FRAME F=0
TAG POS=1 TYPE=BUTTON ATTR=ID:Export
WAIT SECONDS=10
TAB T=1
TAG POS=1 TYPE=SPAN ATTR=TXT:Criteria

My 2cts, but a few "Things" could be playing a Role, and a few Things you could try to narrow and troubleshoot the Issue...:

1- I remember during the Beta-Phase for v10.0.2 for FF that the early Versions had some Pb with Frames and the Script would just hang forever like you describe. Those Issues were then solved from some later Beta-Version, but maybe not for all "Cases", like combined with an 'ONDOWNLOAD' Command...
=> Try moving the 'ONDOWNLOAD' directly before the 'TAG' Statement triggering the Download:

Code: Select all

FRAME F=0
ONDOWNLOAD FOLDER=Z:\archive\az_yuma\{{!NOW:yyyymmdd}} FILE=az_yuma_all_all_{{!NOW:yyyymmdd}}_00{{!VAR2}}.csv WAIT=YES
TAG POS=1 TYPE=BUTTON ATTR=ID:Export

2- Also to try/test would be to first leave the 'FOLDER' + 'FILE' Params use their Default Values to see if that first works, and then "reactivate" those 2 Params one by one:

Code: Select all

FRAME F=0
ONDOWNLOAD FOLDER=* FILE=* WAIT=YES
TAG POS=1 TYPE=BUTTON ATTR=ID:Export

3- + Also to test with a Local Folder on your own PC, before trying to create the Folder on the 'z:' (Mapped) Network Drive... :idea:


Site is behind L&P, so I couldn't have a look... (Well, I only have the 'Free' Version for v10.0.2 for FF anyway, so I would only be able to test with the Default Params... :P )
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
mshamblin
Posts: 6
Joined: Mon Aug 14, 2017 4:27 pm

Re: ondownload alternative

Post by mshamblin » Fri Jan 15, 2021 1:29 am

chivracq wrote:
Thu Jan 14, 2021 11:42 pm
mshamblin wrote:
Thu Jan 14, 2021 11:16 pm
Thanks Tom

We have upgraded to ff 84 with iMacros 10.0.2.1450 and we do have the FIO-Module and we are having problems saving the files from the save dialog box. This works perfectly in FF 56 with Imacros 8.9.7. We have tried all we know to get it to save the file. What am I missing?? It does not give any errors it just stops at the ondownload command. The save dialog box pops up as normal but it just sits there.
Thanks,
Mike

Code: Select all

URL GOTO=https://yuma.paragonrels.com/ParagonLS/Default.mvc
TAG POS=1 TYPE=SPAN ATTR=ID:search-nav
TAG POS=1 TYPE=A ATTR=TXT:Saved<SP>Property<SP>Searches
WAIT SECONDS=1
FRAME F=9
TAG POS=1 TYPE=A ATTR=TXT:CA_RNT
WAIT SECONDS=3
FRAME F=10
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/ParagonLS/Search/Property.mvc/Search/6 ATTR=ID:f_621_Low CONTENT=01/21/2019
TAG POS=1 TYPE=BUTTON ATTR=ID:Search
WAIT SECONDS=7
FRAME F=12
TAG POS=1 TYPE=A ATTR=TXT:Export<SP>»
WAIT SECONDS=2 
TAG POS=1 TYPE=A ATTR=TXT:Export<SP>to<SP>CSV
WAIT SECONDS=3
SET !VAR2 0
ADD !VAR2 1
ONDOWNLOAD FOLDER=Z:\archive\az_yuma\{{!NOW:yyyymmdd}} FILE=az_yuma_all_all_{{!NOW:yyyymmdd}}_00{{!VAR2}}.csv WAIT=YES
FRAME F=0
TAG POS=1 TYPE=BUTTON ATTR=ID:Export
WAIT SECONDS=10
TAB T=1
TAG POS=1 TYPE=SPAN ATTR=TXT:Criteria
My 2cts, but a few "Things" could be playing a Role, and a few Things you could try to narrow and troubleshoot the Issue...:

1- I remember during the Beta-Phase for v10.0.2 for FF that the early Versions had some Pb with Frames and the Script would just hang forever like you describe. Those Issues were then solved from some later Beta-Version, but maybe not for all "Cases", like combined with an 'ONDOWNLOAD' Command...
=> Try moving the 'ONDOWNLOAD' directly before the 'TAG' Statement triggering the Download:

Code: Select all

FRAME F=0
ONDOWNLOAD FOLDER=Z:\archive\az_yuma\{{!NOW:yyyymmdd}} FILE=az_yuma_all_all_{{!NOW:yyyymmdd}}_00{{!VAR2}}.csv WAIT=YES
TAG POS=1 TYPE=BUTTON ATTR=ID:Export
Thanks for your input chivracq!
I tried moving the ONDOWNLOAD before the tag and it gave me this error and would not run.
"SyntaxError: can not parse macro line 27: Folder=C:\test"

2- Also to try/test would be to first leave the 'FOLDER' + 'FILE' Params use their Default Values to see if that first works, and then "reactivate" those 2 Params one by one:

Code: Select all

FRAME F=0
ONDOWNLOAD FOLDER=* FILE=* WAIT=YES
TAG POS=1 TYPE=BUTTON ATTR=ID:Export
No change when FOLDER and FILE were at their default.

3- + Also to test with a Local Folder on your own PC, before trying to create the Folder on the 'z:' (Mapped) Network Drive... :idea:
No change testing with local folder.
Site is behind L&P, so I couldn't have a look... (Well, I only have the 'Free' Version for v10.0.2 for FF anyway, so I would only be able to test with the Default Params... :P )

I wish I could open it but my license does not allow sharing that info. No license = No job :(

Would it be possible to somehow just let FF automatically download the file into the default folder then have the macro change the file name and location after the download is complete?
OR could I make a .bat file to move and rename the file and have iMacros execute the .bat file at the end of the macro?

Thanks for your help! I feel I am getting closer to figuring this out.
chivracq
Posts: 9716
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: ondownload alternative

Post by chivracq » Fri Jan 15, 2021 2:51 pm

Oh-yeah...!, looks like you got a bit mixed up with the Quoting, ah-ah...! :wink:
OK, I'll try to correct a bit...
mshamblin wrote:
Fri Jan 15, 2021 1:29 am
My 2cts, but a few "Things" could be playing a Role, and a few Things you could try to narrow and troubleshoot the Issue...:

1- I remember during the Beta-Phase for v10.0.2 for FF that the early Versions had some Pb with Frames and the Script would just hang forever like you describe. Those Issues were then solved from some later Beta-Version, but maybe not for all "Cases", like combined with an 'ONDOWNLOAD' Command...
=> Try moving the 'ONDOWNLOAD' directly before the 'TAG' Statement triggering the Download:

Code: Select all

FRAME F=0
ONDOWNLOAD FOLDER=Z:\archive\az_yuma\{{!NOW:yyyymmdd}} FILE=az_yuma_all_all_{{!NOW:yyyymmdd}}_00{{!VAR2}}.csv WAIT=YES
TAG POS=1 TYPE=BUTTON ATTR=ID:Export
Thanks for your input chivracq!
I tried moving the ONDOWNLOAD before the tag and it gave me this error and would not run.
"SyntaxError: can not parse macro line 27: Folder=C:\test"

Hum, I think you didn't test this Part "correctly", the "SyntaxError: can not parse macro line 27: Folder=C:\test" means to me that you had the following "Standalone" Line in your Script:

Code: Select all

Folder=C:\test
... which is not correct..., 'FOLDER' is a Param that "belongs" to the 'ONDOWNLOAD' Command, it cannot be used alone... :shock:

(And try to "respect" the (conventional) Use of All-Uppercase for iMacros Commands + Params + Built-in Vars... All those are "normally" Case Insensitive indeed, but this requires a lot of Coding in the Source Code, and you "never know", there is always "a Chance" that the Programmer might have forgotten that in "a few Places", so when Testing a Command that doesn't work, you can better use the "Standard" Convention, or you are introducing an extra Parameter/Risk...)

>>>
mshamblin wrote:
Fri Jan 15, 2021 1:29 am
2- Also to try/test would be to first leave the 'FOLDER' + 'FILE' Params use their Default Values to see if that first works, and then "reactivate" those 2 Params one by one:

Code: Select all

FRAME F=0
ONDOWNLOAD FOLDER=* FILE=* WAIT=YES
TAG POS=1 TYPE=BUTTON ATTR=ID:Export

No change when FOLDER and FILE were at their default.

Hum, this is "strange", this should work..., then I'm "afraid" the 'FRAME' is probably the "Culprit", I would think... :(

=> @TechSup will need to do some Testing then, I guess...
But then, hum, @OP, you may want to confirm that the 'Download.iim' + 'ImageDownload.iim' Demo-Macros do work for you...?

>>>
mshamblin wrote:
Fri Jan 15, 2021 1:29 am
3- + Also to test with a Local Folder on your own PC, before trying to create the Folder on the 'z:' (Mapped) Network Drive... :idea:
No change testing with local folder.

OK, back to the 'FRAME' possible Cause...

>>>
mshamblin wrote:
Fri Jan 15, 2021 1:29 am
Site is behind L&P, so I couldn't have a look... (Well, I only have the 'Free' Version for v10.0.2 for FF anyway, so I would only be able to test with the Default Params... :P )

I wish I could open it but my license does not allow sharing that info. No license = No job :(

Would it be possible to somehow just let FF automatically download the file into the default folder then have the macro change the file name and location after the download is complete?
OR could I make a .bat file to move and rename the file and have iMacros execute the .bat file at the end of the macro?

Thanks for your help! I feel I am getting closer to figuring this out.

About "somehow just let FF automatically download the file into the default folder then have the macro change the file name and location after the download is complete?", => well, the "ONDOWNLOAD FOLDER=* FILE=* WAIT=YES" would first need to work, ah-ah...!

Then about "and have iMacros execute the .bat file at the end of the macro?", yep, several Ways to do so with v8.9.7 for FF, in pure JS (in/from a '.js' Script), that can (probably) be ported to use with the 'URL GOTO=javascript' Syntax, or using some FF Add-on ('External Applications Buttons'), but all those are not supported in v10.0.2, I'm not sure if the Add-on got converted to the 'WebExtensions' Architecture to work with FF56+, but that Method requires the 'EVENT' Mode, which is not supported in v10.0.2 for FF anyway...
But hum, the pure JS Method can possibly/probably be embedded in a Local '.html' Page, so that could be a Way...

The "pure JS Method":

Code: Select all

'Open Local File from '.js' Script:
'var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); 
'file.initWithPath("C:\\_abc\\myfile.bat"); 
'file.launch();
(Without all the Single Quotes as Comments of course, I keep that Syntax in one of my '.iim' Scripts...)
And it works with all kinds of (executable) Files, '.bat'/'.ps'/'.exe' etc..., in v8.8.2 + v8.9.7 for FF + PM26/FF55 + Win10_x64.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Tom, Tech Support
Posts: 3681
Joined: Mon May 31, 2010 4:59 pm

Re: ondownload alternative

Post by Tom, Tech Support » Fri Jan 15, 2021 4:06 pm

mshamblin wrote:
Thu Jan 14, 2021 11:16 pm
Tom, Tech Support wrote:
Thu Jan 14, 2021 9:44 am
chivracq wrote:
Tue Jan 12, 2021 12:47 am
I'll ping @TechSup anyway if they want to have a look at your Thread and confirm if what I mentioned about 'ONDOWNLOAD' for v10.0.2 for FF is correct...
Yes, ONDOWNLOAD is supported in the latest version of iMacros for Firefox. Uploading files, however, currently is not supported.
Thanks Tom

We have upgraded to ff 84 with iMacros 10.0.2.1450 and we do have the FIO-Module and we are having problems saving the files from the save dialog box. This works perfectly in FF 56 with Imacros 8.9.7. We have tried all we know to get it to save the file. What am I missing?? It does not give any errors it just stops at the ondownload command. The save dialog box pops up as normal but it just sits there.
Thanks,
Mike

URL GOTO=https://yuma.paragonrels.com/ParagonLS/Default.mvc
TAG POS=1 TYPE=SPAN ATTR=ID:search-nav
TAG POS=1 TYPE=A ATTR=TXT:Saved<SP>Property<SP>Searches
WAIT SECONDS=1
FRAME F=9
TAG POS=1 TYPE=A ATTR=TXT:CA_RNT
WAIT SECONDS=3
FRAME F=10
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/ParagonLS/Search/Property.mvc/Search/6 ATTR=ID:f_621_Low CONTENT=01/21/2019
TAG POS=1 TYPE=BUTTON ATTR=ID:Search
WAIT SECONDS=7
FRAME F=12
TAG POS=1 TYPE=A ATTR=TXT:Export<SP>»
WAIT SECONDS=2
TAG POS=1 TYPE=A ATTR=TXT:Export<SP>to<SP>CSV
WAIT SECONDS=3
SET !VAR2 0
ADD !VAR2 1
ONDOWNLOAD FOLDER=Z:\archive\az_yuma\{{!NOW:yyyymmdd}} FILE=az_yuma_all_all_{{!NOW:yyyymmdd}}_00{{!VAR2}}.csv WAIT=YES
FRAME F=0
TAG POS=1 TYPE=BUTTON ATTR=ID:Export
WAIT SECONDS=10
TAB T=1
TAG POS=1 TYPE=SPAN ATTR=TXT:Criteria
Make sure you are heeding the advice here:

https://wiki.imacros.net/iMacros_for_Fi ... ding_Files

For example, the first time I run the demo Download macro using the current version of iMacros for Firefox, I have to click the Save File radio button and check 'Do this automatically for files like this from on' on the save dialog. Thereafter, the macro handles the download automatically and saves to the target FOLDER.
Regards,

Tom, iMacros Support
mshamblin
Posts: 6
Joined: Mon Aug 14, 2017 4:27 pm

Re: ondownload alternative

Post by mshamblin » Sat Jan 16, 2021 8:50 pm

Tom, Tech Support wrote:
Fri Jan 15, 2021 4:06 pm
mshamblin wrote:
Thu Jan 14, 2021 11:16 pm
Tom, Tech Support wrote:
Thu Jan 14, 2021 9:44 am


Yes, ONDOWNLOAD is supported in the latest version of iMacros for Firefox. Uploading files, however, currently is not supported.
Thanks Tom

We have upgraded to ff 84 with iMacros 10.0.2.1450 and we do have the FIO-Module and we are having problems saving the files from the save dialog box. This works perfectly in FF 56 with Imacros 8.9.7. We have tried all we know to get it to save the file. What am I missing?? It does not give any errors it just stops at the ondownload command. The save dialog box pops up as normal but it just sits there.
Thanks,
Mike

URL GOTO=https://yuma.paragonrels.com/ParagonLS/Default.mvc
TAG POS=1 TYPE=SPAN ATTR=ID:search-nav
TAG POS=1 TYPE=A ATTR=TXT:Saved<SP>Property<SP>Searches
WAIT SECONDS=1
FRAME F=9
TAG POS=1 TYPE=A ATTR=TXT:CA_RNT
WAIT SECONDS=3
FRAME F=10
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/ParagonLS/Search/Property.mvc/Search/6 ATTR=ID:f_621_Low CONTENT=01/21/2019
TAG POS=1 TYPE=BUTTON ATTR=ID:Search
WAIT SECONDS=7
FRAME F=12
TAG POS=1 TYPE=A ATTR=TXT:Export<SP>»
WAIT SECONDS=2
TAG POS=1 TYPE=A ATTR=TXT:Export<SP>to<SP>CSV
WAIT SECONDS=3
SET !VAR2 0
ADD !VAR2 1
ONDOWNLOAD FOLDER=Z:\archive\az_yuma\{{!NOW:yyyymmdd}} FILE=az_yuma_all_all_{{!NOW:yyyymmdd}}_00{{!VAR2}}.csv WAIT=YES
FRAME F=0
TAG POS=1 TYPE=BUTTON ATTR=ID:Export
WAIT SECONDS=10
TAB T=1
TAG POS=1 TYPE=SPAN ATTR=TXT:Criteria
Make sure you are heeding the advice here:

https://wiki.imacros.net/iMacros_for_Fi ... ding_Files

For example, the first time I run the demo Download macro using the current version of iMacros for Firefox, I have to click the Save File radio button and check 'Do this automatically for files like this from on' on the save dialog. Thereafter, the macro handles the download automatically and saves to the target FOLDER.
We were able to get it to download!! We did have to adjust the FF browser settings. One step closer!
But it did not put the file into the correct folder and did not rename it.
We we are trying different spots for the ONDOWNLOAD command to see if the placement is off.
So far no luck so I think we may have to use the local html page and a script like chivracq suggested.

Thanks to both of you for your help!
mshamblin
Posts: 6
Joined: Mon Aug 14, 2017 4:27 pm

Re: ondownload alternative

Post by mshamblin » Sun Jan 17, 2021 5:30 pm

chivracq wrote:
Fri Jan 15, 2021 2:51 pm
Oh-yeah...!, looks like you got a bit mixed up with the Quoting, ah-ah...! :wink:
OK, I'll try to correct a bit...
mshamblin wrote:
Fri Jan 15, 2021 1:29 am
My 2cts, but a few "Things" could be playing a Role, and a few Things you could try to narrow and troubleshoot the Issue...:

1- I remember during the Beta-Phase for v10.0.2 for FF that the early Versions had some Pb with Frames and the Script would just hang forever like you describe. Those Issues were then solved from some later Beta-Version, but maybe not for all "Cases", like combined with an 'ONDOWNLOAD' Command...
=> Try moving the 'ONDOWNLOAD' directly before the 'TAG' Statement triggering the Download:

Code: Select all

FRAME F=0
ONDOWNLOAD FOLDER=Z:\archive\az_yuma\{{!NOW:yyyymmdd}} FILE=az_yuma_all_all_{{!NOW:yyyymmdd}}_00{{!VAR2}}.csv WAIT=YES
TAG POS=1 TYPE=BUTTON ATTR=ID:Export
Thanks for your input chivracq!
I tried moving the ONDOWNLOAD before the tag and it gave me this error and would not run.
"SyntaxError: can not parse macro line 27: Folder=C:\test"

Hum, I think you didn't test this Part "correctly", the "SyntaxError: can not parse macro line 27: Folder=C:\test" means to me that you had the following "Standalone" Line in your Script:

Code: Select all

Folder=C:\test
... which is not correct..., 'FOLDER' is a Param that "belongs" to the 'ONDOWNLOAD' Command, it cannot be used alone... :shock:

(And try to "respect" the (conventional) Use of All-Uppercase for iMacros Commands + Params + Built-in Vars... All those are "normally" Case Insensitive indeed, but this requires a lot of Coding in the Source Code, and you "never know", there is always "a Chance" that the Programmer might have forgotten that in "a few Places", so when Testing a Command that doesn't work, you can better use the "Standard" Convention, or you are introducing an extra Parameter/Risk...)

>>>
mshamblin wrote:
Fri Jan 15, 2021 1:29 am
2- Also to try/test would be to first leave the 'FOLDER' + 'FILE' Params use their Default Values to see if that first works, and then "reactivate" those 2 Params one by one:

Code: Select all

FRAME F=0
ONDOWNLOAD FOLDER=* FILE=* WAIT=YES
TAG POS=1 TYPE=BUTTON ATTR=ID:Export

No change when FOLDER and FILE were at their default.

Hum, this is "strange", this should work..., then I'm "afraid" the 'FRAME' is probably the "Culprit", I would think... :(

=> @TechSup will need to do some Testing then, I guess...
But then, hum, @OP, you may want to confirm that the 'Download.iim' + 'ImageDownload.iim' Demo-Macros do work for you...?

>>>
mshamblin wrote:
Fri Jan 15, 2021 1:29 am
3- + Also to test with a Local Folder on your own PC, before trying to create the Folder on the 'z:' (Mapped) Network Drive... :idea:
No change testing with local folder.

OK, back to the 'FRAME' possible Cause...

>>>
mshamblin wrote:
Fri Jan 15, 2021 1:29 am
Site is behind L&P, so I couldn't have a look... (Well, I only have the 'Free' Version for v10.0.2 for FF anyway, so I would only be able to test with the Default Params... :P )

I wish I could open it but my license does not allow sharing that info. No license = No job :(

Would it be possible to somehow just let FF automatically download the file into the default folder then have the macro change the file name and location after the download is complete?
OR could I make a .bat file to move and rename the file and have iMacros execute the .bat file at the end of the macro?

Thanks for your help! I feel I am getting closer to figuring this out.

About "somehow just let FF automatically download the file into the default folder then have the macro change the file name and location after the download is complete?", => well, the "ONDOWNLOAD FOLDER=* FILE=* WAIT=YES" would first need to work, ah-ah...!

Then about "and have iMacros execute the .bat file at the end of the macro?", yep, several Ways to do so with v8.9.7 for FF, in pure JS (in/from a '.js' Script), that can (probably) be ported to use with the 'URL GOTO=javascript' Syntax, or using some FF Add-on ('External Applications Buttons'), but all those are not supported in v10.0.2, I'm not sure if the Add-on got converted to the 'WebExtensions' Architecture to work with FF56+, but that Method requires the 'EVENT' Mode, which is not supported in v10.0.2 for FF anyway...
But hum, the pure JS Method can possibly/probably be embedded in a Local '.html' Page, so that could be a Way...

The "pure JS Method":

Code: Select all

'Open Local File from '.js' Script:
'var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); 
'file.initWithPath("C:\\_abc\\myfile.bat"); 
'file.launch();
(Without all the Single Quotes as Comments of course, I keep that Syntax in one of my '.iim' Scripts...)
And it works with all kinds of (executable) Files, '.bat'/'.ps'/'.exe' etc..., in v8.8.2 + v8.9.7 for FF + PM26/FF55 + Win10_x64.
I have read this several times a day since you posted it and want to be sure I understand what you are saying. You are saying this will NOT work in v10.0.2 or are you saying there are workarounds like a local .html page that we can use to kick off a .bat file? I am not super familiar with .html or how that would work.
We will have to use v10.0.2 there is no going back now unfortunately.
Post Reply