Page 1 of 2
Once again: ONDOWNLOAD is ignored
Posted: Thu Mar 11, 2010 9:16 pm
by mguttman
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!
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
Re: Once again: ONDOWNLOAD is ignored
Posted: Mon Mar 15, 2010 10:44 pm
by mguttman
Hello Daniel,
Pleeeeeease! Help!
Meir
Re: Once again: ONDOWNLOAD is ignored
Posted: Tue Mar 16, 2010 3:29 pm
by Daniel, Tech Support
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,
Re: Once again: ONDOWNLOAD is ignored
Posted: Tue Mar 16, 2010 7:20 pm
by mguttman
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
Re: Once again: ONDOWNLOAD is ignored
Posted: Tue Mar 16, 2010 7:44 pm
by Daniel, Tech Support
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?
Re: Once again: ONDOWNLOAD is ignored
Posted: Tue Mar 16, 2010 8:36 pm
by mguttman
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
Re: Once again: ONDOWNLOAD is ignored
Posted: Tue Mar 23, 2010 2:36 pm
by Daniel, Tech Support
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,
Re: Once again: ONDOWNLOAD is ignored
Posted: Tue Mar 23, 2010 3:31 pm
by mguttman
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.
Re: Once again: ONDOWNLOAD is ignored
Posted: Wed Mar 24, 2010 3:28 pm
by Daniel, Tech Support
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
Re: Once again: ONDOWNLOAD is ignored
Posted: Wed Mar 24, 2010 4:40 pm
by mguttman
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
Re: Once again: ONDOWNLOAD is ignored
Posted: Tue Mar 30, 2010 11:46 am
by Daniel, Tech Support
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
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.
Re: Once again: ONDOWNLOAD is ignored
Posted: Tue Mar 30, 2010 12:06 pm
by mguttman
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
Re: Once again: ONDOWNLOAD is ignored
Posted: Tue Mar 30, 2010 12:10 pm
by Daniel, Tech Support
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,
Re: Once again: ONDOWNLOAD is ignored
Posted: Tue Mar 30, 2010 12:18 pm
by mguttman
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.)
Re: Once again: ONDOWNLOAD is ignored
Posted: Tue Mar 30, 2010 12:35 pm
by Daniel, Tech Support
Hmm... It works just perfectly here... And you're running Firefox with privileges sufficient for the folder where you're trying to save it?