I'm a cron (Cronnix) user, but because of my erratic work schedule, I occasionally need to run a cron job manually before its scheduled time. The problem is that it runs again via cron when its time rolls around. The following script uses AppleScript properties to avoid delivering the same payload twice in any one (calendar) day.
property last_run : ""
set today to date string of (current date)
if last_run is not today then
set last_run to today
display dialog "hi" -- your payload here
end if
The value of a script property is automatically stored whenever the script runs, so this script essentially remembers when it was run last, and behaves accordingly. The initial value of last_run is an empty string so the payload does get delivered the very first time the script runs. Using such scripts in cron is easier for me than than touching / checking / deleting a tmp file....
If you want to get fancier, it's not hard to give a warning instead of silently aborting.
property last_run : ""
set today to date string of (current date)
if last_run is today then
display dialog "You already did this today." buttons {"Cancel", "Do it again"}
end if
-- if you're still here, do your thing
set last_run to today
display dialog "hi" -- your payload here
[robg adds: I haven't tested this one myself...]
Mac OS X Hints
http://hints.macworld.com/article.php?story=20030221130634389