OnDownload gets stuck

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
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
Post Reply
dgrossman2
Posts: 18
Joined: Sun Jan 20, 2008 2:54 am

OnDownload gets stuck

Post by dgrossman2 » Wed Jan 30, 2008 10:15 pm

Here's my latest attempt to save a pdf file on disk. The macro succeeds in showing the pdf file, but then it gets stuck on the next to last step, and the file is not saved on disk.

Furthermore, if I stop the macro and then try to restart it, it then gets stuck on the VERSION step.

I also tried reversing the slant of the slashes in the ONDOWNLOAD step. And I also tried ONDOWNLOAD FOLDER=* FILE=* . No change.

So I still don't know how to save a pdf file on disk.

VERSION BUILD=6100118
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=watidesign.com
TAB T=1
TAG POS=1 TYPE=FONT ATTR=TXT:2008<SP>Spring/Summer<SP>Collection
TAG POS=1 TYPE=U ATTR=TXT:Collection
TAG POS=1 TYPE=HTML ATTR=TXT:Wati,<SP>Clothing*
ONDOWNLOAD FOLDER="C:\Documents and Settings\Owner\Desktop" FILE=temp.pdf
WAIT SECONDS=10
TAG POS=1 TYPE=U ATTR=TXT:here
WAIT SECONDS=10 <<<<< It gets stuck here
PAUSE
Dave Grossman
User avatar
Tech Support
Posts: 4948
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Post by Tech Support » Thu Jan 31, 2008 9:33 pm

Does our PDF demo macro work for you?

http://wiki.imacros.net/Demo-SavePDF
dgrossman2
Posts: 18
Joined: Sun Jan 20, 2008 2:54 am

Post by dgrossman2 » Thu Jan 31, 2008 10:13 pm

No it does not. It downloads a 1-page PDF test document, and then it gets stuck on step 6: ONDOWNLOAD FOLDER=* FILE=+_{{!NOW:yyyymmdd_hhnnss}}

It never gets to step 7 SAVEITEM.

Furthermore, after it gets stuck. If I stop it and then play it again, it gets stuck on step 0 VERSION...
Dave Grossman
dgrossman2
Posts: 18
Joined: Sun Jan 20, 2008 2:54 am

The event log looks like this - on and on and on

Post by dgrossman2 » Fri Feb 01, 2008 2:32 pm

1/31/2008 6:29:41 AM 3576 Non-HTML document URL=http://www.iopus.com/imacros/demo/v6/pd ... 20Test.pdf
1/31/2008 6:29:41 AM 3576 PDF>Skip internal BACKhttp://www.iopus.com/imacros/demo/v6/pdf/Inter ... 20Test.pdf
1/31/2008 6:29:42 AM 3576 Non-HTML document URL=http://www.iopus.com/imacros/demo/v6/pd ... 20Test.pdf
1/31/2008 6:29:42 AM 3576 PDF>Skip internal BACKhttp://www.iopus.com/imacros/demo/v6/pdf/Inter ... 20Test.pdf
1/31/2008 6:29:43 AM 3576 Non-HTML document URL=http://www.iopus.com/imacros/demo/v6/pd ... 20Test.pdf
1/31/2008 6:29:43 AM 3576 PDF>Skip internal BACKhttp://www.iopus.com/imacros/demo/v6/pdf/Inter ... 20Test.pdf
1/31/2008 6:29:44 AM 3576 Non-HTML document URL=http://www.iopus.com/imacros/demo/v6/pd ... 20Test.pdf
Dave Grossman
mknoll1
Posts: 174
Joined: Fri Dec 23, 2005 4:14 pm

Post by mknoll1 » Fri Feb 01, 2008 3:13 pm

Have you tried adding CONTENT=EVENT:SAVETARGETAS? THe whole line would be


TAG POS=1 TYPE=U ATTR=TXT:here CONTENT=EVENT:SAVETARGETAS


As far as I can tell this simulates a right click and choosing save target. In most cases this has worked for me.

If that does not work you may want to go to windows explorer and go to Tools --> folder options --> File Types and find the .pdf extension and delete it. Doing this will make windows save the file when you click on it rather than open it since it won't know what program to use. On the downside when you need to open the file Windows won't know what program to use.
dgrossman2
Posts: 18
Joined: Sun Jan 20, 2008 2:54 am

That seems to work

Post by dgrossman2 » Fri Feb 01, 2008 4:27 pm

That works. Thank you very much! But I'm mystified as to how you knew that.

The User Manual does NOT list the TAG subcommand
CONTENT=EVENT:SAVETARGETAS

The user manual does list the TAG subcommands
CONTENT=EVENT:SAVETARGET and
CONTENT=EVENT:#SAVEITEM
but neither of them worked for me.

So, how did you know about SAVETARGETAS? Is there another better user guide somewhere that I don't know about?
Dave Grossman
dgrossman2
Posts: 18
Joined: Sun Jan 20, 2008 2:54 am

But there's still a problem for me

Post by dgrossman2 » Fri Feb 01, 2008 5:10 pm

The problem is that I don't want to use the TAG command to get to the pdf page. I want to use the URL GOTO command to go there directly. And with URL GOTO, there is no subcommand CONTENT:... so the above method doesn't work.

I can probably code around this by creating on my disk a file temp.html with a link to the desired URL, then doing a URL=file://etc to get to the file on my disk, and then doing a TAG to click through to the URL with the pdf file. This would probably work, but it's incredibly silly. Does anyone know an easier way?
Dave Grossman
User avatar
Tech Support
Posts: 4948
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Post by Tech Support » Sat Feb 02, 2008 1:22 am

Why do you want to avoid using the TAG command?
dgrossman2
Posts: 18
Joined: Sun Jan 20, 2008 2:54 am

Avoiding the TAG command

Post by dgrossman2 » Sat Feb 02, 2008 4:33 am

By way of background, I should mention that I've been programming for over 50 years.

My application is a rather complex scripting system that I've written in perl. It involves retrieving a large number of files from a online repository of pdf files. It's quite important that I keep track of what I've already retrieved to avoid retrieving the same file more than once. So, it's necessary to process the repository index first. This index is not just on a single web page, but rather is on a 4-level hierarchy of web pages. As this process runs, it generates flat files of urls I want to retrieve.

The whole process has to be dynamic, because the repository I'm accessing tends to change the urls every day.

Once a flat file of urls is available, the process reads the urls and actually retrieves the files. For this purpose I was planning on using URL GOTO.

But since URL GOTO doesn't seem to allow downloading of pdf files, as a workaround I added a short script that determines the next file to download, writes a file temp.htm with that as the only link, and then TAGs to it. The TAG is able to do the pdf download.

Another way of accomplishing the same thing would have been dynamically to generate an HTML file of urls instead of generating a flat file of urls. The process could then TAG through all its links. It happens that I didn't write the code this way, but it wouldn't have been a big deal to modify it.

But it would have been nice if these sorts of workarounds weren't needed.

Anyhow, my workaround is written, and I'm in the process of debugging, so this is no longer a problem for me.
Dave Grossman
Post Reply