Once again: ONDOWNLOAD is ignored

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
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
mguttman
Posts: 31
Joined: Sat Jan 09, 2010 7:32 pm

Once again: ONDOWNLOAD is ignored

Post by mguttman » Thu Mar 11, 2010 9:16 pm

Searching the forums here I discovered that there were numerous complaints about this ONDOWNLOAD statement being ignored. The latest one I found was as recent as last September (2009). Well, I encountered it too.

I am using the latest FireFox and iMacro plugin on a continuously updated WinXP Pro SP3 platform.

I created two macros by manually editing a recorded session:

The first (I'll refer to it as the "TAS" download):

Code: Select all

VERSION BUILD=6600217 RECORDER=FX
TAB T=1
URL GOTO=https://www.tase.co.il/TASEEng/MarketData/RawData/FileDistribution.htm
URL GOTO=https://www.tase.co.il/FileDistribution/TargetFolder/08031101.tas
ONDOWNLOAD FOLDER=C:\My<SP>Documents\Temp\Assemble FILE=file_803_{{!NOW:yyyymmdd}}.tas WAIT=YES
ONDOWNLOAD FOLDER=C:\My<SP>Documents\Temp\Assemble FILE=file_803_{{!NOW:yyyymmdd}}.tas WAIT=YES
TAG POS=1 TYPE=A ATTR=TXT:163
(This download has another problem which I posted separately.)

And the second (I'll refer to this as the TSV download):

Code: Select all

VERSION BUILD=6600217 RECORDER=FX
TAB T=1
URL GOTO=http://www.tase.co.il/TASEEng/MarketData/SecuritiesInfo/SecuritiesInfo.htm?NRMODE=Published&NRORIGINALURL=%2fTASEEng%2fMarketData%2fSecuritiesInfo%2f&NRNODEGUID=%7b3C7B8E3F-64E3-4A38-9027-6ED04A1F6EE6%7d&NRCACHEHINT=Guest
TAG POS=1 TYPE=A ATTR=TXT:Additional<SP>Columns
TAB T=2
FRAME F=0
TAG POS=1 TYPE=IMG ATTR=SRC:http://www.tase.co.il/TASE/Images/English/Export/close_but_left.gif
TAG POS=1 TYPE=A ATTR=TXT:TSV
ONDOWNLOAD FOLDER=C:\My<SP>Documents\Temp\Assemble FILE=TASE_sec_info_{{!NOW:yyyymmdd}}.tsv WAIT=YES
ONDOWNLOAD FOLDER=C:\My<SP>Documents\Temp\Assemble FILE=TASE_sec_info_{{!NOW:yyyymmdd}}.tsv WAIT=YES
TAB T=2
TAB CLOSE
TAB T=1
The first one works! The second doesn't! :evil:

The only significant difference between the two downloads I can discern is:
* The TAS (first) download is for a fully formed file placed there and downloaded as-is.
* The TSV (second) download is for an HTML table which is converted to a TSV (Tab-Separated-Values) file as a result of clicking the option. The code behind the TSV text is:

Code: Select all

<a  class="ExcelLink" onclick="javascript:customWindowOpen('/TASE/Pages/Export.aspx?sn=Excelds&TblId=0&Titles=en-US_AddColTitles&Columns=en-US_AddColColumns&enumTblType=SecuritiesInfo&AddCol=1&ExportType=4', '_blank', 'scrollbars=yes; toolbar=yes; menubar=yes; resizable=yes', 800, 450);return false;"
href="javascript:void(0)">TSV</a>
So folks, any solution???

Regards,
Meir
Regards,
Meir
mguttman
Posts: 31
Joined: Sat Jan 09, 2010 7:32 pm

Re: Once again: ONDOWNLOAD is ignored

Post by mguttman » Mon Mar 15, 2010 10:44 pm

Hello Daniel,

Pleeeeeease! Help!

Meir
Regards,
Meir
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: Once again: ONDOWNLOAD is ignored

Post by Daniel, Tech Support » Tue Mar 16, 2010 3:29 pm

Hello Meir,

Again, I am very sorry about the delay, we are all very busy here, developing some nice things for you guys :)

I believe all you have to do is reposition ONDOWNLOAD before the command that triggers download, i.e. change this:

Code: Select all

TAG POS=1 TYPE=A ATTR=TXT:TSV
ONDOWNLOAD FOLDER=C:\My<SP>Documents\Temp\Assemble FILE=TASE_sec_info_{{!NOW:yyyymmdd}}.tsv WAIT=YES
ONDOWNLOAD FOLDER=C:\My<SP>Documents\Temp\Assemble FILE=TASE_sec_info_{{!NOW:yyyymmdd}}.tsv WAIT=YES
to this:

Code: Select all

ONDOWNLOAD FOLDER=C:\My<SP>Documents\Temp\Assemble FILE=TASE_sec_info_{{!NOW:yyyymmdd}}.tsv WAIT=YES
ONDOWNLOAD FOLDER=C:\My<SP>Documents\Temp\Assemble FILE=TASE_sec_info_{{!NOW:yyyymmdd}}.tsv WAIT=YES
TAG POS=1 TYPE=A ATTR=TXT:TSV
Best regards,
Daniel, iOpus Support
mguttman
Posts: 31
Joined: Sat Jan 09, 2010 7:32 pm

Re: Once again: ONDOWNLOAD is ignored

Post by mguttman » Tue Mar 16, 2010 7:20 pm

Hi Daniel,

Sorry pal, I read many times about it and that was my first attempt, to no avail...

Please see my explanation in my other post. This page converts (exports) first, only then it downloads the resultant.

Regards,
Meir
Regards,
Meir
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: Once again: ONDOWNLOAD is ignored

Post by Daniel, Tech Support » Tue Mar 16, 2010 7:44 pm

Hi Meir,

I understand, but ONDOWNLOAD is only an event descriptor, not a command that does the download, so anything that triggers the download event should go after it. Have you tried it that way?
Daniel, iOpus Support
mguttman
Posts: 31
Joined: Sat Jan 09, 2010 7:32 pm

Re: Once again: ONDOWNLOAD is ignored

Post by mguttman » Tue Mar 16, 2010 8:36 pm

Hi Daniel,

Yes, of course I did. The fact remain though that in these two scripts one descriptor is consistently obeyed, and in the other it is consistently ignored.

IMHO, here you have an excellent test case, a consistent one, for analyzing the behavior of your code and find why this misbehaves. Would I be you, I would jump on it!

Regards,
Meir
Regards,
Meir
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: Once again: ONDOWNLOAD is ignored

Post by Daniel, Tech Support » Tue Mar 23, 2010 2:36 pm

Hi Meir,

Unfortunately the URL from the 2nd script (that doesn't work) doesn't open any more (expired?). Could you regenerate it please?

Thanks,
Daniel, iOpus Support
mguttman
Posts: 31
Joined: Sat Jan 09, 2010 7:32 pm

Re: Once again: ONDOWNLOAD is ignored

Post by mguttman » Tue Mar 23, 2010 3:31 pm

Dear Daniel,

I copied and pasted the very same script from the forum page and "played" it. It worked in the sense that as before, it downloaded the required file, but contrary to the edited ONDOWNLOAD clause it did so to the default directory as opposed to the ONDOWNLOAD specified directory and used the site's name rather that the ONDOWNLOAD specified name.

(I hesitate to state the obvious, but you do understand that you have to change the directory and file names for your machine.)

I nevertheless regenerated the macro but edited the (this time single) ONDOWNLOAD clause the same way:

Code: Select all

VERSION BUILD=6600217 RECORDER=FX
TAB T=1
URL GOTO=http://www.tase.co.il/TASEEng/MarketData/SecuritiesInfo/
TAG POS=1 TYPE=A ATTR=TXT:Additional<SP>Columns
TAB T=2
FRAME F=0
TAG POS=1 TYPE=TD ATTR=TXT:Export<SP>Table<SP>Data
TAG POS=1 TYPE=A ATTR=TXT:TSV
TAB T=3
ONDOWNLOAD FOLDER=C:\My<SP>Documents\Temp\Assemble FILE=TASE_sec_info_{{!NOW:yyyymmdd}}.tsv WAIT=YES
TAB T=3
TAB CLOSE
TAB T=2
As a matter of fact I added a workaround for this problem by including a rename/move code in my PERL script. However, this has another problem that I will post shortly. :(
Regards,
Meir
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: Once again: ONDOWNLOAD is ignored

Post by Daniel, Tech Support » Wed Mar 24, 2010 3:28 pm

Hi Meir,

In my Windows 7 it doesn't work unless I run iMacros as an administrator. Probably because by default apps don't have access to the relevant folder. Could you please try to run it in admin mode (right-click, choose "Run as Administrator")?

Thanks,
Daniel
Daniel, iOpus Support
mguttman
Posts: 31
Joined: Sat Jan 09, 2010 7:32 pm

Re: Once again: ONDOWNLOAD is ignored

Post by mguttman » Wed Mar 24, 2010 4:40 pm

Dear Daniel,

I hope I understood you. I couldn't run the Macro itself in Admin mode. What I did was to open the FireFox browser in Admin mode. And it did the same: indeed downloading, but ignoring the ONDOWNLOAD clause. In other words, The folder was the default FireFox download folder and the file name was the site's default file name.

(I tried to login as the Administrator and "play" the macro. To my surprise, The iMacro button was nowhere to be found and I didn't even find iMacro in the Start menu. I didn't want to reinstall it. I couldn't risk my regular environment.)

And Daniel, please be specific when you write "worked". What did you mean: "Worked" in the sense that it was successful to complete the download, or "worked" in the sense that the ONDOWNLOAD was obeyed?

Regards,
Meir
Regards,
Meir
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: Once again: ONDOWNLOAD is ignored

Post by Daniel, Tech Support » Tue Mar 30, 2010 11:46 am

Hello Meir,

This is quite a funny issue... The thing is that if you do this:

Code: Select all

VERSION BUILD=6600217 RECORDER=FX
TAB T=1
URL GOTO=http://www.tase.co.il/TASEEng/MarketData/SecuritiesInfo/
TAG POS=1 TYPE=A ATTR=TXT:Additional<SP>Columns
TAB T=2
FRAME F=0
TAG POS=1 TYPE=TD ATTR=TXT:Export<SP>Table<SP>Data
ONDOWNLOAD FOLDER=C:\Users\Daniel\Desktop FILE=TASE_sec_info_{{!NOW:yyyymmdd}}.tsv WAIT=YES
TAG POS=1 TYPE=A ATTR=TXT:TSV
it fails, but if you add a tiny little

Code: Select all

URL GOTO=http://www.Google.com
to the end of it, it works. Would you please use this workaround for now and I will raise an internal ticket to get it fixed.
Daniel, iOpus Support
mguttman
Posts: 31
Joined: Sat Jan 09, 2010 7:32 pm

Re: Once again: ONDOWNLOAD is ignored

Post by mguttman » Tue Mar 30, 2010 12:06 pm

Dear Daniel,

To start from the end: no, it didn't work! (At least not in my ecosystem which I guess is not that different from yours, may be even with fewer barriers between my machine and the Internet.) It still used the site's default name and was downloaded into the default download directory of Firefox.

I must admit that my first reaction was "What!? What has the Google site to do with anything?" But nevertheless I tried. And it behaved as before, see above.

Sorry
Regards,
Meir
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: Once again: ONDOWNLOAD is ignored

Post by Daniel, Tech Support » Tue Mar 30, 2010 12:10 pm

Meit,

Could you please run this:

Code: Select all

VERSION BUILD=6600217 RECORDER=FX
TAB T=1
URL GOTO=http://www.tase.co.il/TASEEng/MarketData/SecuritiesInfo/
TAG POS=1 TYPE=A ATTR=TXT:Additional<SP>Columns
TAB T=2
FRAME F=0
TAG POS=1 TYPE=TD ATTR=TXT:Export<SP>Table<SP>Data
ONDOWNLOAD FOLDER=C:\Users\Daniel\Desktop FILE=TASE_sec_info_{{!NOW:yyyymmdd}}.tsv WAIT=YES
TAG POS=1 TYPE=A ATTR=TXT:TSV
URL GOTO=http://www.Google.com
It isn't about Google, it could be just any other page, but the thing is that ONDOWNLOAD seems to refuse to work at the end of the macro. I raised a ticket on the subject and it will be fixed soon.

Best regards,
Daniel, iOpus Support
mguttman
Posts: 31
Joined: Sat Jan 09, 2010 7:32 pm

Re: Once again: ONDOWNLOAD is ignored

Post by mguttman » Tue Mar 30, 2010 12:18 pm

Dear Daniel,

I am sorry, but no, it works as before, default name and download dir.

(IMHO the culprit is the fact that between the HTML page and the exported TSV file, there is an exporting script, translating the (source of the) HTML page into Tab-Separated-Value (TSV) text.)
Regards,
Meir
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: Once again: ONDOWNLOAD is ignored

Post by Daniel, Tech Support » Tue Mar 30, 2010 12:35 pm

Hmm... It works just perfectly here... And you're running Firefox with privileges sufficient for the folder where you're trying to save it?
Daniel, iOpus Support
Post Reply