Simple Desktops Desktop Downloader

I like having a steady stream of desktop wallpapers. I dislike the time and attention it takes to download new desktops. I wrote up this script to help me download the bulk of simpledesktops.com wallpapers. It is set up so you can download batches by setting the curr to the last downloaded image # + 1 and adjusting the repeat.

property curr : 1 -- where to start
set turl to "http://simpledesktops.com/download/?desktop="
global turl



repeat 500 times -- Download how many in this batch
	set searchurl to turl & curr
	set testsystem to do shell script "curl -s " & searchurl & " | awk '/simply not/'"
	--display dialog testsystem
	set curr to curr + 1
	if testsystem does not contain "<h2>It's simply not here.</h2>" then -- Does the URL exist?
		downloadimg(searchurl)
	end if
end repeat

on downloadimg(searchurl)
	tell application "Safari"
		set URL of document 1 to searchurl
		delay 2
		set theURL to URL of document 1
	end tell
	tell application "URL Access Scripting"
		download theURL to "HD:Users:aaon:Desktop:Simple:" & curr & ".jpg" -- you will need to adjust this line accordingly
	end tell
	
end downloadimg

I’m sure there could be a better way but I had issues with simpledesktops and their redirection so I just used Safari in the background to process the redirect and then I have applescript grab the new URL and download the file. I just have Safari minimized and it runs without issue while I continue on with my work.

Hi,

solution without Safari


property curr : 1 -- where to start
set turl to "http://simpledesktops.com/download/?desktop="
set destinationFolder to ((path to desktop as text) & "Simple:")

repeat 500 times -- Download how many in this batch
	set searchurl to turl & curr
	set testsystem to do shell script "curl -s " & searchurl & " | awk '/simply not/'"
	--display dialog testsystem
	set curr to curr + 1
	if testsystem does not contain "<h2>It's simply not here.</h2>" then -- Does the URL exist?
		do shell script "curl -L " & space & quoted form of searchurl & " -o " & quoted form of (POSIX path of destinationFolder & curr & ".jpg")
	end if
end repeat