The AppleScript delay command

AppleScript FAQ: Can you show an example of the AppleScript delay command (function)?

Solution

If you get into a situation where you want your AppleScript code to “sleep” for a period of time, use the delay command, like this example:

display dialog 1 buttons {"OK"}
delay 3
display dialog 2

When you click OK after the first dialog, your AppleScript program goes to sleep for three seconds, then displays the second dialog.

I know this isn’t the most practical example, but it’s a simple sleep/delay AppleScript example, so I hope the simplicity of it is helpful.