Forum rulesBefore 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:

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.

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">

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.

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.

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).

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.

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

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!

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.

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 )

It seems like the ONDOWNLOAD only works with the EVENT: parameter..., but i can't get the direct link.

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 .

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

When I try the code with Firefoxit 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 ExplorerThe 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?