how to call a applescript/shell script without waiting for it

hi there

from a script A i need to kick off an applescript (or shell script) B which runs independently on its own while the calling script A already has fully terminated.

what do i need this for? in Mail i want to quit the app itself by an email. so i have a mail rule starting a script A on a specific email. this script cannot quit mail: mail would hang, because the script is called inside Mail’s own rule processor. so i thought of kicking of a 2nd script B which waits a little bit until the first script has terminated for sure (and Mail is idle again) - and then it quits Mail.

so, this is what i did:

script A is “call–quit-mail.scpt”:

do shell script "/Users/Shared/bin/remote--quit-mail.scpt &"

script B is “remote–quit-mail.scpt”:

delay 5
tell application "Mail" to quit

although script B is called with the background ampersand, script A waits until B returns. don’t understand why.

any ideas?

thanks heaps, olli

Model: mac mini
AppleScript: Std AS of Mac OS X 10.5.5
Browser: Firefox 3.0.3
Operating System: Mac OS X (10.5)

From Technical Note TN2065: do shell script in AppleScript:

Try something like this:

do shell script "/Users/Shared/bin/remote--quit-mail.scpt &> /dev/null &"

thanks for this! yes, indeed, with the &> in the shell command it works. - i guess the calling process is waiting as long as there is some output still possible. anyway, now it works like a treat.

– olli