Delay a script without using the delay command

I currently have a script that uses the delay command in a project I am making in XCode. I was wondering how to make my script delay without using that command, because when I use that command, my whole app freezes up until the delay is over. I want it to be waiting in the background, while stilll allowing users to use my app’s features. I know of the way to delay it that uses a dialog box with a “giving up after {delay time}”, but that way isn’t very clean cut. Thanks in advance!

The only other way I know of (aside from some sort of timing loop) to wait is: do shell script “sleep x” where x is in seconds and sleep in the shell is a delay. Don’t know whether that will let your app be responsive, however.

Hi,

a different way for a delay is an idle handler (which will be called, when the app does “nothing”),
but the programming technique is also “different” :wink:

How do u make a shell script thing with the delay command? and what is different about an idle handler?

Both solutions depend on what you’re going to accomplish

You haven’t given nearly enough info to be more specific.

You can also ‘hide’ your app process, yet leave it available for later user access from the Dock… but again, unless you can tell us more about your specific need, it’s difficult to help.

Peter B.