Improving my script for image downloading

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
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
Posts: 1
Joined: Fri Oct 31, 2014 7:01 pm

Improving my script for image downloading

Post by jmnp » Sat Nov 01, 2014 10:33 am

Hi there,

May I ask you some advices in order to improve my script? I am just basic user. I am using a script for automatically download a large amount of images from a regional archive website. The images are church records I need for genealogy purposes.

Here is an example of the website:

Each page of the website represents a different parish book, for example in this page you will find the list of births in a given local community in 1895. The parish book has 23 images that I want to download (it is perfectly legal, no problem: I just prefer to have all the files in my computer so I can make pdf files, easier to examine). Now, I want to do the same for several years, so I open several tabs, each tab = a specific year = a specific book of church records. At the moment, I use my script to download the 23 images of the first book (first tab) with the Loop option and I enter as a max value for loop 5000 (the number of images may vary). At the end of each book, the macro exhibits this error:

RuntimeError, element INPUT specified by ID.ViewerControl1_ImageButtonThumbnailNext was not found, line 5 (Error code: -921).
That is not a problem for me, because it means the work is done, so I go the second tab e do the same for the next book, and so on.

Now, I would like Imacro to automatically go to the second tab and continue the work, when the "error" appears. I don't know how to do this.
So, supoose I've got 10 tabs open, I want Imacro to download images from the first tab, then the "error" appears, Imacro should close the first tab and go the second tab, download images. Then "error" appears at the end again, so Imacro closes the second tab e goes to the third. And so on. Until the tenth tab.

Here is my current script (feel free to run it with the website I mentioned earlier, it might help to understand):
TAG POS=1 TYPE=IMG ATTR=SRC: ... ad_big.png
TAG POS=1 TYPE=INPUT:IMAGE FORM=ID:formMain ATTR=ID:ViewerControl1_ImageButtonThumbnailNext

If there is no possibility to do this, alternatively I would like to receive a sound when that error appears: it would help me to know that I must close the tab and go to another, because I am working at the same time on other things, I am not always seeing it.

My English is far from perfect, so please ask me if my questions are not clear.

Thank you very much in advance,
Best regards
Post Reply