/ entropy-start.applescript
entropy-start.applescript
1 on clicked theObject 2 -- Read in the preferences 3 set theLocation to POSIX path of (call method "defaultObjectForKey:" with parameter "entropy") 4 5 try 6 set theResult to do shell script "ps -ax | grep entropy" as string 7 if theResult contains "./entropy" then 8 try 9 -- have a try because canceling dialog results in the Gadzooks error 10 display dialog "Error: Entropy is currently running." 11 tell progress indicator "eprogress" of window "main" to start 12 end try 13 else 14 try 15 do shell script "cd " & theLocation & ";sh run.sh > /dev/null 2>&1 &" 16 tell progress indicator "eprogress" of window "main" to start 17 on error 18 display dialog "Error: Unable to execute run.sh. Might it be missing?" 19 end try 20 end if 21 on error 22 display dialog "Gadzooks! I couldn't find 'ps'!!!" 23 end try 24 25 end clicked 26