Running multiple scripts

Hi

I am new to this so my apologies if the question sounds stupid.

I am trying to run an applescript (script A) that calls another script (B) and continues immediately without waiting for the script B to complete.

The idea is for A to call B and then during idle to check whether B is still running from time to time.

Below is the code of script A. Problem is that the

------------------------Script A

on run

display dialog "open" giving up after 3

if application "pieter" is not running then

tell application "macintosh HD:Users:pieterboshoff:Downloads:scripts:pieter.app" to activate

return

end if

display dialog "activated" giving up after 3

-- add a longish delay to allow the application to start

delay 6

display dialog "end run" giving up after 3

end run

on idle


if application "pieter" is not running then

display dialog "Not running" buttons {"Run", "Quit"}

if button returned of result = "Run" then

tell application "macintosh HD:Users:pieterboshoff:Downloads:scripts:pieter.app" to activate


-- add a longish delay to allow the application to start


else

-- nothing

end if


else

display dialog "Running" buttons {"Ok", "Quit"}

if button returned of result = "Ok" then

-- Nothing

else

if button returned of result = "Quit" then

quit

end if

end if


end if

return 3

end idle

on quit


-- do whatever you want to do after the application has quit

if application "pieter" is running then

tell application "macintosh HD:Users:pieterboshoff:Downloads:scripts:pieter.app" to quit

-- allow the app to quit itself

end if

continue quit


end quit

------------------------ end of Script A

The problem is that the dialog "activated" won't display as it waits for script "pieter" to complete before it shows.

I want it so show immediately after the activate command.

This also means that the system does not go into idle until after script "pieter" has completed.

Running multiple scripts
 
 
Q