set theWindowTitle to "PerlMonks" set theOption to text returned of (display dialog "Enter a sourceFolder:" & return default answer "" with title theWindowTitle) set thePerlscript to quoted form of (POSIX path of ((choose file with prompt "Select a script:") as Unicode text)) set cmd to thePerlscript & " -S " & theOption & " &> /dev/null" & " & echo $!" display dialog "Command: " & cmd with title theWindowTitle do shell script cmd set pid to the result display dialog "PID: " & pid with title theWindowTitle display dialog "Kill the proccess (" & pid & ")" buttons {"OK"} with title theWindowTitle do shell script ("kill " & pid)