AppleScript cocoa app freezes when running shell script

kyiosus

Registered
Hello,

I'm trying to make an AppleScript based cocoa application with Xcode, which runs shell scripts. The problem is, I have a progress bar which is meant to run while performing the shell script, but the whole app freezes while the script runs, and then unfreezes when the script is done executing. Here is a code snippet:

Code:
on clicked theObject
   if title of theObject is "Start" then
      do shell script "cp -r ~/Sites ~/Desktop/Sites"
      start progress indicator "bar" of window "Main"
      set title of theObject to "Stop"
   else if title of theObject is "Stop" then
      set title of theObject to "Start"
      stop progress indicator "bar" of window "Main"
   end if
end clicked

The above shell script is used for testing, but I will still be doing the cp command when completing the app. Is there anyway to fix this? Thanks for the help! :)
 
Back
Top