Solved

Download Images from URL list with Automator

Posted on 2010-09-09
6
2,195 Views
Last Modified: 2013-11-12
Hi,

I've followed various tutorials that in some cases seem to get quite close, but never close enough:

I have a list of URL's that represent images that - if I wish - I can view and download via my browser.

The only prob is that the list I have is about 1000 rows:  Automator can follow and download one at a time it seems, except that when I paste in 2+ to Get Specified Text it fails.

My feeling is that this is to do with the way that rows are delimited by Automator at the text to URL conversion stage.

I have tried csv, tab-delimited and copying out of excel:  no joy:  can anybody think of why this is stumbling over?

Many thanks in advance.

0
Comment
Question by:jeaniem
  • 3
  • 2
6 Comments
 
LVL 9

Expert Comment

by:MBobrek
ID: 33643306
It seems as though Automator is treating your 2+ in there without a HARD return meaning that it's one single line.  Is there any indication that you can force a hard return, or in a preferences area set each line to include a hard return?  

One program I use when I run in a windows environment is FlashGet.  http://www.flashget.com
I haven't had any problems at all downloading various file types with this app.  
0
 
LVL 12

Accepted Solution

by:
nxnw earned 125 total points
ID: 33668198
Never used automator, but several applications are available that should do the job. Bulkloader comes to mind.

Alternatively, paste the attached code snippet into applescript editor and save as an application.

You drop a text file, containing a series of URLs (one per line, i.e separated by hard returns) on the application. It creates a date stamped folder in your downloads folder and downloads each file listed to that new folder.

If there is a dead or mistyped URL, it just skips it without warning, however.  You can code in something to provide a warning in the "on error" clause.


on open thefile
	
	tell application "Finder"
		activate
		set thefile to POSIX path of thefile
		open for access thefile
		set thelist to (read thefile)
		close access thefile
		set foldername to (the month of (current date) as string) & (the day of (current date) as string) & "-" & (do shell script "date '+%H_%M_%S'")
		set folderpath to path to downloads folder as string
		make new folder at folderpath with properties {name:foldername}
		set folderpath to folderpath & foldername & ":"
	end tell
	
	set oldDelimiter to AppleScript's text item delimiters
	set AppleScript's text item delimiters to {"/"}
	
	tell application "URL Access Scripting"
		activate
		repeat with x from 1 to the number of paragraphs in thelist
			set theURL to paragraph x of thelist
			set newFile to folderpath & (the last text item of theURL)
			try
				with timeout of 120 seconds
					download theURL to file newFile
				end timeout
			on error
				set AppleScript's text item delimiters to oldDelimiter
				quit
			end try
			delay 1
		end repeat
		set AppleScript's text item delimiters to oldDelimiter
		quit
	end tell

Open in new window

0
 

Author Comment

by:jeaniem
ID: 33671518
It's working!

Thank you very much indeed - I might note that the files that come down need to be renamed with .png in order to produce an image:  they're not very pretty with .txt written after!

I can't believe how hard it's been to find a solution for this on mac if you're no whiz at scripting or other:  it's possible that the line wraps had something to do with this however.

Many thanks indeed.
0
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 

Author Closing Comment

by:jeaniem
ID: 33671524
Thank you very much indeed!
0
 
LVL 12

Expert Comment

by:nxnw
ID: 33671603
The line "set newFile to folderpath & (the last text item of theURL)" just uses the original name of the file as the downloaded file name. I don't know why it would end up being named with a txt extension, unless it already has one.

In any event, if you change that line to:

set newFile to folderpath & (the last text item of theURL) & ".png"

it will tack the png extension to the end of each file name.
0
 

Author Comment

by:jeaniem
ID: 33671624
Great!

Thank you very much again - massive help!

AF
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We could spend the next millennium discussing the differences of the Mac and Windows platforms. The next century will continue to have fanatics on both side of the equation and neither side will win the war. However, that’s not why we are here. W…
In this article we have discussed about the OS X EI Capitan and how to fix Wi-Fi issue in OS X El Capitan. We have explained how to delete system level preferences and create a new Wi-Fi location to resolve Wi-Fi issue.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question