ONDOWNLOAD problem with csv & xls file type.

Discussions and Tech Support specific to the iMacros Firefox add-on.
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
mepanousis
Posts: 4
Joined: Wed Nov 24, 2010 2:27 am

ONDOWNLOAD problem with csv & xls file type.

Post by mepanousis » Sat Nov 27, 2010 10:41 pm

First i want to say thanks to imacros developers. This is one of my most important tools at my work.

I've spent already more that 4 weeks reading imacros forums and experiment with commands before my decision to post my problem. Still i am willing to do anything it takes to solve my problem. My problem is very simple. I am connecting to a server that generates a report with the same name always once you click on a button. The report needs about of 17 seconds to generate and then normally i am having a small pop up window asking me where to save.The report has the format of filename.csv but also i have an option to generate the same report as txt(using another button in the same page with the same delay) so the name would be filename.txt

No matter what I’ve tried ONDOWNLOAD works only with txt format type and the funny thing is that it doesn’t need anything special ... a command Wait=yes is enough

Today I’ve notice that i ONDOWNLOAD doesn’t work with xls file type also. Even when i record a macro ONDOWNOAD doesn’t react at all with the downloading procedure.
I've tried all Mozilla versions from 3 to 4 , and all imacros versions from 6.7 to 7.3
*When i used a very old Mozilla version 3.0.19 it worked for only a couple of times with a lot of wait switches.

When i download to txt format(from exacly the same server/page and with exactly the same time conditions using any Mozilla/macros/windows version) i really don’t need to do something special. Everything works fine but unfortunately i need to be able to download csv and xls file types.

Here is the code from the downloading part
ONDOWNLOAD FOLDER=myforder FILE=*
`MANY COMBINATIONS OF WAITSECONDS=x
TAG POS=1 TYPE=IMG ATTR=TXT:<IMG<SP>title="CSV<SP>Report"<SP>border=0<SP>alt=""<SP>src="/****/docroot/client/***/***/images/xl.gif">

(I am using asterisks to hide private data)


This is the code when I choose to download as txt (this one works fine)
TAG POS=1 TYPE=IMG ATTR=TXT:<IMG<SP>title="TXT<SP>Report"<SP>border=0<SP>alt=""<SP>src="/*****/docroot/client/*****/****/images/ICTXT.jpg">

I hope that someone can give me any idea.
Tom, Tech Support
Posts: 3834
Joined: Mon May 31, 2010 4:59 pm

Re: ONDOWNLOAD problem with csv & xls file type.

Post by Tom, Tech Support » Tue Nov 30, 2010 12:20 pm

Hello mepanousis,

Can you please post the URL of the web page and/or the macro that creates the problem? This would allow us to quickly re-create the issue on our test systems. If you can not do it in a public forum, please email the URL/macro to support AT iopus.com and mention this forum post.
Regards,

Tom, iMacros Support
mepanousis
Posts: 4
Joined: Wed Nov 24, 2010 2:27 am

Re: ONDOWNLOAD problem with csv & xls file type.

Post by mepanousis » Wed Dec 01, 2010 2:25 am

Tom, iOpus wrote:Hello mepanousis,

Can you please post the URL of the web page and/or the macro that creates the problem? This would allow us to quickly re-create the issue on our test systems. If you can not do it in a public forum, please email the URL/macro to support AT iopus.com and mention this forum post.

Thank you very much for reading my problem. I wish i could give you the URL that i am using but that cannot be done for security and practical reasons. I am downloading csv/xls files from two servers , the first one can be accessed only locally and the second one is a communications company server that can be accessed only with a personal username/pass.I will post as much as i can from the macro

This is the macro that doesn't work.Even when i am recording the macro i don't have the Recording dialog.The .csv file seems to be totally ignored by the imacros.

VERSION BUILD=7031111 RECORDER=FX
TAB T=1
URL GOTO=about:blank
URL GOTO=https://************.******.**:****/******/client/*****/******/login.jsp
FRAME F=1
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:loginForm ATTR=NAME:USERNAME CONTENT=*************
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:loginForm ATTR=NAME:PASSWORD CONTENT=**********
TAG POS=1 TYPE=INPUT:BUTTON FORM=NAME:cl_search ATTR=VALUE:search
ONDOWNLOAD FOLDER=myfolder FILE=* WAIT=YES
TAG POS=1 TYPE=IMG ATTR=SRC:https://************.***.**:****/****/docroot/client/***/***/images/xl.gif

The same server gives the choice to download in txt format , so here is the macro that works with no problem which is actually quite the same with the other one.When i am recording this one(choosing to download data in txt format this time)i DO see the Recording dialog window of imacros.Actually the choice of txt does solve a part of my problems but i still need to be able to download csv and xls file types into specific folders(which i haven't manage so far).

VERSION BUILD=7031111 RECORDER=FX
TAB T=1
URL GOTO=about:blank
URL GOTO=https://************.******.**:****/******/client/*****/******/login.jsp
FRAME F=1
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:loginForm ATTR=NAME:USERNAME CONTENT=*************
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:loginForm ATTR=NAME:PASSWORD CONTENT=**********
TAG POS=1 TYPE=INPUT:BUTTON FORM=NAME:cl_search ATTR=VALUE:search
ONDOWNLOAD FOLDER=myfolder FILE=* WAIT=YES
TAG POS=1 TYPE=IMG ATTR=SRC:https://*****************.**:******/****/docroot/client/***/***/images/ICTXT.jpg
TAG POS=1 TYPE=A ATTR=TXT:exit
URL GOTO=www.google.com

Here is a link with the same problem that i hope it can help you

http://www.ypepth.gr/docs/diorismoibthm ... 091221.xls

ondownload doesn't seem to react with the above xls file just the same.It works with zip file from the same page just fine.
siniy
Posts: 118
Joined: Sat Nov 07, 2009 7:44 pm

Re: ONDOWNLOAD problem with csv & xls file type.

Post by siniy » Wed Dec 01, 2010 3:00 pm

When I had issues with ONDOWNLOAD command, I set up firefox so its download file itself without any dialogs. Check downloads settings in firefox Options, General tab.
Tom, Tech Support
Posts: 3834
Joined: Mon May 31, 2010 4:59 pm

Re: ONDOWNLOAD problem with csv & xls file type.

Post by Tom, Tech Support » Wed Dec 01, 2010 4:24 pm

Hi mepanousis,

The first time I run the following macro, I get a Firefox dialog asking me if I want to open the file with an application or save the file:

Code: Select all

URL GOTO=http://www.ypepth.gr/docs/diorismoibthmias_20091218_internet_091221.xls
Firefox_save.png
If I select "Save File" and check "Do this automatically...", then the file is automatically saved to the Firefox Downloads folder each time.

If you have a direct link to the file that you can click on, you can control the name and location of the downloaded file by using the ONDOWNLOAD command combined with CONTENT=EVENT:SAVETARGETAS at the end of the TAG command for the file link. But since it doesn't look like you have a direct link to the file, then the first method (as also suggested by siniy) is probably preferable.
Regards,

Tom, iMacros Support
mepanousis
Posts: 4
Joined: Wed Nov 24, 2010 2:27 am

Re: ONDOWNLOAD problem with csv & xls file type.

Post by mepanousis » Thu Dec 02, 2010 1:34 am

I really appreciate a lot he time that you spend for my problem , i will try the direct link tip as i thing that one of the servers gives me a direct link.
I am using already the default mozilla folder but i have to use also many scheduled .bat files that move/rename each of the files.I do hope in a future version imacros will not have any of these problems :?
Tom, Tech Support
Posts: 3834
Joined: Mon May 31, 2010 4:59 pm

Re: ONDOWNLOAD problem with csv & xls file type.

Post by Tom, Tech Support » Thu Dec 02, 2010 7:37 pm

I do hope in a future version imacros will not have any of these problems
This is not a problem of iMacros per se. iMacros is behaving in accordance with your browser settings/configuration. Because the .xls type is a pre-defined MIME type that Mozilla Firefox recognizes, any time you attempt to open an excel file in the browser the action as specified in the Tools - Options - Applications settings for that file type are taken.

In order to be able to download that file like any other file, you need to use the SAVETARGETAS event, which as I already stated, requires you to have a direct link to the file.

Another alternative would be to delete the MIME type for Excel files, so that Firefox then handles the file like any other file. If someone knows how you can easily remove a MIME type (aka a Content Type) from Firefox, please post it here!
Regards,

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

Re: ONDOWNLOAD problem with csv & xls file type.

Post by Tom, Tech Support » Tue Dec 07, 2010 2:22 pm

Hello mepanousis,

I recently worked on a similar issue for another customer (he was downloading a CSV file, not XLS, but the situation is the same as yours in that he didn't have a direct link to the file - a click on a button would initiate the download). The solution for him was to make sure Firefox is configured to 'Always ask' when downloading Excel files (via Tools - Options - Applications), PLUS he had to add a delay (WAIT SECONDS=5) after the TAG command which initiated the download. This was necessary because the TAG command which initiates the download was at the end of his macro and the macro was ending before the download had a chance to start, as explained in this note for the ONDOWNLOAD command.

Once he made these changes then the macro successfully saved the CSV file to the folder he specified in the ONDOWNLOAD command.

Please consider whether these same steps will help in your situation.
Regards,

Tom, iMacros Support
yquant
Posts: 19
Joined: Tue Nov 16, 2010 10:00 am

Re: ONDOWNLOAD problem with csv & xls file type.

Post by yquant » Thu Dec 09, 2010 2:03 pm

I have a problem with the ONDOWNLOAD command as well. I have to tag a INPUT:SUBMIT in order to start the download. Firefox will save the filetype automatically, so the dialog that is asking me, where I want to save the file, opens up. Normally the ONDOWNLOAD command should take care of this(?), but doesn't.

I tried to add a 5 second waiting time like you suggested. After doing so, I got the error that no download occured:
RuntimeError: ONDOWNLAD command was used but no downalod occurred.
(also there's a typo in the error return :P )

It seems like the ONDOWNLOAD only works with the EVENT: parameter..., but i can't get the direct link.
mepanousis
Posts: 4
Joined: Wed Nov 24, 2010 2:27 am

Re: ONDOWNLOAD problem with csv & xls file type.

Post by mepanousis » Fri Dec 10, 2010 3:40 am

Tom, iOpus wrote:Hello mepanousis,

I recently worked on a similar issue for another customer (he was downloading a CSV file, not XLS, but the situation is the same as yours in that he didn't have a direct link to the file - a click on a button would initiate the download). The solution for him was to make sure Firefox is configured to 'Always ask' when downloading Excel files (via Tools - Options - Applications), PLUS he had to add a delay (WAIT SECONDS=5) after the TAG command which initiated the download. This was necessary because the TAG command which initiates the download was at the end of his macro and the macro was ending before the download had a chance to start, as explained in this note for the ONDOWNLOAD command.

Once he made these changes then the macro successfully saved the CSV file to the folder he specified in the ONDOWNLOAD command.

Please consider whether these same steps will help in your situation.
I have figure it out since your previous post but honestly , i wouldn't find something like this myself as i was persuaded that i have to look for something much more complicated !!!!!!

I cannot find the words to thank you. My daily preparation for work demands some times multiple csv files up to 200000 lines each ! Now a big part of this work goes on automatically and i have to thank you one more time.
I apologize for not answering back earlier (that it works) but since i solve my downloading issue i was really busy to make my databases fast enough so they can be useful :D .

Keep up the good work ! This is a five star plugin !
Tom, Tech Support
Posts: 3834
Joined: Mon May 31, 2010 4:59 pm

Re: ONDOWNLOAD problem with csv & xls file type.

Post by Tom, Tech Support » Thu Dec 16, 2010 6:31 pm

yquant,

Perhaps you need a delay longer than 5 seconds. The error you are receiving is because the macro is ending before the download starts. And thanks for pointing out the typo, we were already aware of it and it should be fixed in the next release :)

mepanousis,

Glad to hear you got it working, and thanks for the accolades!
Regards,

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

Re: ONDOWNLOAD problem with csv & xls file type.

Post by Tom, Tech Support » Tue May 17, 2011 12:43 am

UPDATE: Additional information regarding this topic can be found in Tips for downloading files with ONDOWNLOAD.
Regards,

Tom, iMacros Support
jpcancino
Posts: 1
Joined: Thu Jan 05, 2012 8:15 pm

Re: ONDOWNLOAD problem with csv & xls file type.

Post by jpcancino » Thu Jan 05, 2012 8:22 pm

i'm having the same problem and I try the posted solution but it is not work for me.

This is my code:

Code: Select all

VERSION BUILD=7401110 RECORDER=FX
TAB T=1
URL GOTO=https://live.barcap.com/UAB/ct_logon_basic?CT_ORIG_URL=%2FBC%2Fdispatcher&ct_orig_uri=%2FBC%2Fdispatcher
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:passwdForm ATTR=NAME:user CONTENT=***
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:passwdForm ATTR=NAME:password CONTENT=***
TAG POS=1 TYPE=INPUT:IMAGE ATTR=VALUE:Submit&&SRC:https://live.barcap.com/BC_S/images/bclogin/btn_login.gif
...
TAG POS=1 TYPE=INPUT:RADIO FORM=NAME:timeseriesinput ATTR=NAME:dateFormat&&VALUE:dd/MM/yyyy
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:timeseriesinput ATTR=NAME:startdate CONTENT=01/01/2012
ONDOWNLOAD FOLDER=* FILE=wsJP.xls
TAG POS=1 TYPE=IMG ATTR=SRC:https://live.barcap.com/FIA/INDICES/images/xls.gif 
WAIT SECONDS=5 
It's pop up save to windows.
tester45
Posts: 1
Joined: Sat Feb 04, 2012 7:18 am

Re: ONDOWNLOAD problem with csv & xls file type.

Post by tester45 » Sat Feb 04, 2012 8:46 am

Hello, sorry to bump an older thread.

I am having the same issue that jpcancino is having.

I have a website that I login to and eventually reach a location where there is a download hat is launched by clicking on a gif file, a javascript=onclick event launches the download.

The code that I use for it is

Code: Select all

ONDOWNLOAD FOLDER=* FILE=Example.csv WAIT=YES 
TAG POS=1 TYPE=IMG FORM=ID:fN ATTR=SRC:(url)/XLExport.gif
WAIT SECONDS=15
When I try the code with Firefox
it comes up with the error "RuntimeError: ONDOWNLOAD command was used but no download occurred. (Error code: -804)". As the download window comes up and I can click OK to save it, but the Ondownload does not apparently recognize it to rename it and save the file. Turning on the automatically download files will work but the problem is the information in the file and the default file name don't tell me who the file is for and so it's important that I rename it right when i download it (cause there are around 50 different files and can't tell which is which without renaming).

When I try the code with Internet Explorer
The file is downloaded but it can't be renamed. It comes up with the error "Error -1400: Cannot find downloaded file C:\(location)\Example.csv" when the location of the file is correct. It downloads but is unable to rename the file?


The download demo script works correctly, it can download and rename the file without any problems. I believe the problem comes from the fact that I don't have a direct link to the file, just a javascript:onclick event that will launch the download from clicking on a gif link.

Anyone have any hint on what might be wrong or how to go about doing this?


Thanks
cqp
Posts: 5
Joined: Sat Jul 07, 2012 2:52 am

Re: ONDOWNLOAD problem with csv & xls file type.

Post by cqp » Wed Jul 18, 2012 2:04 am

Hi - I'm having the same issues as tester45. Link to download is in JS, and ONDOWNLOAD doesn't seem to realize that file save dialog window has opened -- any solution here?
Post Reply