Automatic download from a Web page

Discussions and Tech Support related to the iMacros Google Chrome extension.
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
Post Reply
syn
Posts: 1
Joined: Fri Aug 13, 2010 9:25 am

Automatic download from a Web page

Post by syn » Fri Aug 13, 2010 9:47 am

First: Iam sorry for my english.

Hello,

i have a big problem. I must download 1800 files from a webpage for a cleandb. Normally I would use perl ,shell script and Regular Expressions for get the links and download the files with curl or wget. The problem is they is a Javascript and no direct link to a FTP server. The Page look like this

[Filename] [information link] [another link] Download

For example this page as 40 oder 50 files. So i try to handle the job with imacro. I record....click on a part with files and the download button. Now this is my macro.

Code: Select all

ERSION BUILD=1110311 RECORDER=CR
URL GOTO=https://webpage/default.aspx
TAG POS=1 TYPE=LABEL ATTR=ID:lnk_IT
WAIT SECONDS=10
TAG POS=1 TYPE=LI ATTR=ID:164
WAIT SECONDS=10
TAG POS=2 TYPE=A ATTR=TXT:Download
WAIT SECONDS=10
TAG POS=3 TYPE=A ATTR=TXT:Download
WAIT SECONDS=10
TAG POS=4 TYPE=A ATTR=TXT:Download
WAIT SECONDS=10
TAG POS=5 TYPE=A ATTR=TXT:Download
WAIT SECONDS=10
TAG POS=6 TYPE=A ATTR=TXT:Download
WAIT SECONDS=2000
TAG POS=1 TYPE=LABEL ATTR=ID:lnk_IT this is the language code and this the TAG POS=2 TYPE=A ATTR=TXT:Download link. I must use the WAIT command because the page needs 5-6sek. to answer my download request. And the 2k sek. are beause i can only download max. 6 files at the same time.

What is the problem? Some pages have 10 files to download and other 100 or more. Is there any possibility to search for "TAG POS=6 TYPE=A ATTR=TXT:Download" ? Can and how can i create a loop, for exaple a while loop.
Tom, Tech Support
Posts: 3440
Joined: Mon May 31, 2010 4:59 pm

Re: Automatic download from a Web page

Post by Tom, Tech Support » Tue Aug 17, 2010 1:35 pm

Hi syn,

You really need scripting for the type of loop that will work best in this situation, but unfortunately iMacros for Chrome doesn't currently support scripting. You can however use the Play Loop button with your macro modified in the following way to get a close approximation of what you need:

Code: Select all

VERSION BUILD=1110311 RECORDER=CR
URL GOTO=https://webpage/default.aspx
TAG POS=1 TYPE=LABEL ATTR=ID:lnk_IT
WAIT SECONDS=10

ADD !VAR1 {{!LOOP}}
ADD !VAR1 {{!LOOP}}
ADD !VAR1 {{!LOOP}}
ADD !VAR1 {{!LOOP}}
ADD !VAR1 {{!LOOP}}
ADD !VAR1 {{!LOOP}}

TAG POS={{!VAR1}} TYPE=LI ATTR=ID:164
WAIT SECONDS=10

ADD !VAR1 1
TAG POS={{!VAR1}} TYPE=A ATTR=TXT:Download
WAIT SECONDS=10

ADD !VAR1 1
TAG POS={{!VAR1}} TYPE=A ATTR=TXT:Download
WAIT SECONDS=10

ADD !VAR1 1
TAG POS={{!VAR1}} TYPE=A ATTR=TXT:Download
WAIT SECONDS=10

ADD !VAR1 1
TAG POS={{!VAR1}} TYPE=A ATTR=TXT:Download
WAIT SECONDS=10

ADD !VAR1 1
TAG POS={{!VAR1}} TYPE=A ATTR=TXT:Download
WAIT SECONDS=2000
The problem with this is that it will skip the first 6 download links. So for example, if you set the loop max value to 3, then the first time the macro runs it will click on download links 6 through 11, then 12 through 17, then 18 through 23. You would still have to run your original macro first to click the first 6 links and then you could loop this macro for however many times is required to click on the remaining links on the page.
Regards,

Tom, iMacros Support
Post Reply