Log in

View Full Version : Applescript to download image offline



queerfm
08-07-2008, 10:46 PM
Hi i am trying to make a apple script that will download a random image from google say i want images that match the word "web".

Am trying to work out how to do it as i would like a random wallpaper every 10min. This is what i was thinking

Tell safari to search for keyword Web on google.com download a random image from the search result

rename to wallpaper and save to desktop.

If you can help that would be great
Thanks

tfit
08-08-2008, 07:54 PM
I see a problem here: How do you determine the size of the file? Your desktop will sometimes have an awful look. I can't write applescript, but i can give you an idea what I should do.

I put all the words in a text file and do a sed and strip the first line of the file, append that line to your google query and let wget/surf fetch the file. I don't know the search string for images, but you than have to determine which image you want to retrieve. set it as your desktop and sleep for 10 minutes or put everything in a cron file.
Hope you can get some ideas from this.

Medyman
08-09-2008, 05:00 PM
http://snippets.dzone.com/posts/show/1308

You basically just need this part:

tell application "Finder"
select window of desktop
try
set desktop picture to file (imageFile as text)
on error
display dialog "Invalid image file."
end try
end tell