 <p>Since you are using a Mac, I assume you have Ruby installed.</p> <p>What you are talking about sounds like you want a thread to sleep for 30 seconds and then execute a script in the background.</p> <p>You should put <code>… do some stuff</code> in a script named dostuff.scpt and place it in your Desktop.</p> <p>Then change your current script to the following code:</p> <pre><code>using terms from application "iChat" on logout finished do shell script "ruby -e 'Thread.new {`sleep 30 &amp;&amp; osascript ~/Desktop/dostuff.scpt`}' &amp;&gt; /dev/null" end logout finished end using terms from </code></pre> <p>A code breakdown: do shell script (executes something from the command line)</p> <p>ruby -e (executes ruby code from the command line)</p> <p>Thread.new (makes a new thread to hide in the background)</p> <p>` (Everything in the backtick is a shell command in ruby)</p> <p>osascript (Executes an applescript from the command line)</p> <p>~/Desktop/dostuff.scpt (Points the pathname to your file, the tilde substitutes to your home directory, and I assume you put dostuff.scpt on the Desktop)</p> <p>&amp;> /dev/null (<a href="http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html" rel="nofollow noreferrer">Tells Applescript to not look for output and immediately go to the next code line</a>)</p> <p>I tried doing this without Ruby, however, I had no luck. Let me know if this works for you!</p>