The Situation: You’re doing some work that requires a bunch of images and you’ve found a site that has some great free images that would work very nicely. To get each of the images, however, you need to go through a bunch of steps. First you gotta locate a screen that tells you what’s available — a “thumbnail” screen usually:
Then you have to select the image you want:
… and start the download:
and eventually you get the one image you are after. But then you have to right click to save the image to your disk:
Once that’s finished, you can then go on to the next one.
Wouldn’t it be great if you could find a better way?
There are several Windows automation programs around. We’ve played with a few. Most are too expensive or don’t work, or both. Another approach is to think “simple” — take a look at each step and see if there is a better, faster, automated way to do it.
Keep an eye on the web address window:
(Note: The website isn’t real – but we’re sure you can find one on your own)
This is the last URL seen before the file is downloaded. It was executed by the web page itself, and it’s probably the one we should focus on, because if we could somehow line up a bunch of these URL’s and run them one after the other with the right numbers at the end, we might make the whole process faster. You can test this by typing in the first part before the number then typing in another number – perhaps one from another download – if it works, you’re on the right track.
But how to get the right numbers?
Remember the thumbnail picture above. There are 15 pictures we could examine to see if we could grab them all faster. To do this we need to examine the programming code that created the page.
All the popular web browsers have the ability to view the source. On the Firefox menu bar for example it’s “View -> Page Source”. Here is an example of the output:
Pretty cryptic, even for a programmer. To better see what’s going on it would be great to break the page into separate lines of code . For this we can use a programmer text editor to replace the “<” mark with a “\r <” — the “\r” is code for a new line — (regular “notepad.exe” can’t do this, but “notepad++.exe” sure can) the result being:
we’ve also take the liberty of searching for the number of that image we liked: 28870 and come up with 3 possible lines to search for as a means of collecting the 14 other numbers that are probably on this page as well. Our best bet looks like the string before number:
and indeed, notepad++ found these lines:
It’s now possible to use our “activating” URL :
and replace “28870” with another number from the list to speed up the process a bit.
The purpose of this post has been to demonstrate a very simple use of “View Source” option available in most browsers. It helps to know a bit of “HTML” but, as I hope we’ve seen above, it’s not essential. By following a few clues from your browser, and using a few tricks in your text editor, you should be able to save some time on those repetitive operations.
We’ve saved a little time on a simple operation, but this should be just the first step – the next steps are up to you — how could you automate this process further? How could you collect a bunch of these “get” URL’s into a batch file and run the batch file as a single command? How could you automate the step to download the picture to your hard drive?
There are many ways to do the right thing — drop us a note if you find a new or better way.