I am wondering how to have a popup alert on my computer (Mac OS X) every hour. I figured writing this in Applescript would be pretty simple but I have no Applescript experience. Thanks
The basic handler for doing things on a regular basis in AppleScript is the idle handler.
on idle
display dialog "Go back to work" buttons "Work Harder" default button "Work Harder"
return 3600
end idle
This script will pop up a dialog box when you start the application and then every 3,600 seconds after pressing the button. Whatever number the idle handler returns will be the number of seconds before the next idle event is triggered.
If you want it to be on the hour and not every sixty minutes, you'd want the idle script to return a different number of seconds, perhaps 60, and then check to see if you're at the right part of the hour.
on idle
if the minutes of the (current date) is 30 then
display dialog "Go back to work" buttons "Work Harder" default button "Work Harder"
end if
return 60
end idle
This will only display the dialog at half past. (Like Unix, AppleScript’s concept of the current date includes the current time.)
In each case, you want to save in AppleScript Editor as “Application” and “Stay Open” in order to have it respond to idle events instead of just quitting after running. And you can add the application to your list of “Login Items” in the “Accounts” system preference to make it run automatically when you log in.