Make a script repeat

Hello Everyone,

I like having my local weather radar, updated regularly, as my desktop picture. Desktop Carousel did the trick for me, but it does not work with 10.4.x.

I cobbled this script. It downloads the latest .gif file, places it into my pictures folder (replaces the prior image too). I have the desktop pictures preference set to change the picture every five minutes.

I need to have the script repeat every five minutes to keep the radar image up to date. How do I do this? Also is there a way to synch the new download to the five minute change desktop pictures pref will use?

Thanks in advance.

James

set the target_URL to "http://radar.wunderground.com/data/nids/OKX19_0.gif"
set the destination_file to ((path to pictures folder as string) & "radar.gif")

tell application "URL Access Scripting"
	download target_URL to file destination_file replacing yes
end tell

Something like this (saved as a stay open application that you’ll have to quit from the Activity Monitor) As far as syncronization with the desktop is concerned, I can’t help, but the five minutes is timed from when you start it so if you know when the desktop changes, you could start this 4 minutes and 30 seconds later.

on run
	getMap()
end run

on idle
	getMap()
	return 300
end idle


on getMap()
	set the target_URL to "http://radar.wunderground.com/data/nids/OKX19_0.gif"
	set the destination_file to ((path to pictures folder as string) & "radar.gif")
	
	tell application "URL Access Scripting"
		download target_URL to file destination_file replacing yes
	end tell
end getMap

Thank you very much! Appreciate it.

I saved it as an application, open at logon, stay open. Why will I have to (and how to) quit from the Activity Monitor?

James

We haven’t provided any means (a keystroke for example) for getting out of the idle handler - it will keep going as long as your machine is running, and if you open /Applications/Utilities/Activity Monitor, select the menu tab “My Processes” (just to reduce the number of things to look at) you’ll see it running there (by the name you gave it when you saved it). The only way to make it quit is to select it in that window (click on the name) and click on the “Quit Process” (stop sign shaped) button.

Hi Adam,

I understand. So simply quitting the Radar app, would not kill the idler process. Interesting.

Again, thanks. I missed having the radar on my desktop.

James!

Sorry to mislead, JG. If you’ve saved the app as an application, stay open, you can quit the idle process by quitting the application. I was thinking of saving the app so it was “faceless” which you are not doing.

Hi Adam,

How would I save it as faceless? Takes up less space in my dock that way.

Thanks,

James

Never having done it, I hesitate to answer. It requires that you have and understand Xcode tools. What you are doing basically is creating a daemon.

Hi Adam,

I’ll leave it as an app. It is working perfectly.

Thanks so much!

James