Idle handler to run 9:00 am on weekdays

What is the proper syntax to have an open handler to run 9:00 am on weekdays.
This is what I have so far:

on idle
	set work_Days to {Monday, Tuesday, Wednesday, Thursday, Friday}
	if work_Days contains ((current date)'s weekday) and ((current date)'s time = 9:00 am) then
		tell application "Finder"
do something
	end if
	return 1
end idle

Model: Intel iMac
AppleScript: 2.2
Browser: Safari 419.3
Operating System: Mac OS X (10.5)

Well I think you’re going about this the wrong way. Rather than have a script running that idles for 24 hours at a time I would recommend making a launchd agent that fires off every day and runs your script.

Check out the freeware app Lingon to get started making Launchd agents.

Hi,

running the script 604800 times a week to filter 5 events is an incredible waste of time :wink:
I recommend to use a launchd agent or a crontab entry.

Launchd agents can be created with Lingon,
crontab entries can be created with Cronnix

Thank you both for your recommendations but I don’t understand why is this way an incredible waste of time. What is so different this app Launchd from applescript? I read a little bit & please be nice with me. I’m not a techie person.:confused:

Well launchd is a system level framework that is always running on the machine. Using a AppleScript that is running constantly you are needlessly eating up system resources for an application that is actually only going to run once every 24 hours. Additionally you know need to introduce the script as a login item because if you logout/restart/power failure the script has no chance to run as the idle handler will not be running.

ThankU for the nice & simple explanation. I’ll give it a try