What is a good substitute for the delay command in this situation?

I am trying to make an alarm clock like program in XCode with just Applescript. For now, I have the user typing in a time, then the app delaying until that time. However, while the app is delaying, the user is not able to select any menus or button on the app, forcing them to Force Quit in the app unless they want to wait to their alarm. How can I have my app wait until the time that is input, yet still allow its features to be accessed? Thanks in advance!

Model: iMac G5
AppleScript: Newest
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

You could have your app set up a cron job. When that was done, control would immediately return to your app.

What is a cron job?

Cron is a “daemon to execute scheduled commands”. It’s probably not the solution for an alarm clock application, however. What you require is a timer. That requires a run loop, so you’ll need to implement a system for this with the on idle handler. Look at the first example in the reply to a similar question here:

http://lists.apple.com/archives/applescript-studio/2006/Jan/msg00131.html

Essentially, the idea is that you’re checking during the run loop to see if the time is (or is later than) when you began the timer plus the amount of time you want to wait. If so, do something. If not, ignore (or do something else).

The reply on the applescript-studio list makes it seem “hacky” or ugly, but this is, in concept, how run loops and timers work normally. (E.g., NSTimer instances installed on an NSRunLoop.) It just happens to be more painful in a scripting language than other environments.