Results 1 to 3 of 3

Thread: Applescript to download image offline

  1. #1
    Join Date
    May 2006
    Posts
    266
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Applescript to download image offline

    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
    The web in one word.

  2. #2
    Join Date
    Mar 2008
    Posts
    218
    Thanks
    7
    Thanked 19 Times in 19 Posts

    Default

    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.

  3. #3
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    http://snippets.dzone.com/posts/show/1308

    You basically just need this part:
    Code:
    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •