I have only started programming both Actionscript and Actionscript Studio today so my questions are very newb orientated. Hopefully someone here with significantly more skill than me can point me in the right direction with my problem:
I am trying to make a nice simple interface to a Unix command called Unison which is able to syncronise two or more folders on local or remote servers. Everything is working fine on the command line and I am just struggling with getting my Applescript Studio interface to ‘live update’ as the Unix command is executing. I have a button, a progress bar and a scrolling textfield in my interface. All of them work, but only seem to update once the command has finished executing. How do I get it to flow in a more logical manner? I want to user to click the button, have the progress bar start to twirl to indicate some kind of progress and have the output generated by the Unix command printed to the textfield as it happens.
Here is my Applescript so far:
on clicked theObject
tell progress indicator "progressbar" of window "main" to start
with timeout of 1000000 seconds
try
set theResult to do shell script "sudo /opt/local/bin/unison -batch mybackup 2>&1" as string with administrator privileges
on error errormsg
set theResult to errormsg
end try
set the contents of text view "output" of scroll view "output" of window "main" to theResult
set needs display of text view "output" of scroll view "output" of window "main" to true
end timeout
tell progress indicator "progressbar" of window "main" to stop
end clicked
on should quit after last window closed theObject
return true
end should quit after last window closed
Most of this code is pulled from various tutorials and examples, so there are probably neater ways of doing this. Any advice is greatly appreciated, or if you need any more info let me know.