NOTE: I THINK THIS SHOULD OF BEEN PUT IN CODE EXCHANGE?!?!?
OK WHAT I’M TRYING TO ACHIVE IS TO MAKE A LITTLE PROGRAM FOR MYSELF THAT DOES A TERMINAL COMMAND AND THEN WHEN FINISHED DISPLAY A DIALOG SAYING “COMPLETED”
SO SOMETHING LIKE THIS:
set my theRepairstatusmessage to "Repairing Mac OS X..."
delay 1.0
set my theRepairstatusmessage to "[Please Wait!]"
delay 1.0
set my theRepairstatusmessage to "Repairing Mac OS X..."
delay 1.0
set my theRepairstatusmessage to "[Please Wait!]"
delay 1.0
tell application "terminal" to "/bin/date '+%a %b %e %H:%M' >> " & outFile & ";diskutil repairPermissions / >> " & outFile & ";echo '=-=-=-' >> " & outFile & ";/usr/bin/open " & outFile
-- do shell script "/bin/date '+%a %b %e %H:%M' >> " & outFile & ";diskutil repairPermissions / >> " & outFile & ";echo '=-=-=-' >> " & outFile & ";/usr/bin/open " & outFile
-- set my theRepairCounter to
set my theRepairstatusmessage to "Repairing Mac OS X..."
delay 1.0
set my theRepairstatusmessage to "[Please Wait!]"
delay 1.0
set my theRepairstatusmessage to "Repaired! Mac OS X."
BUT I DONT WANT THE REPAIRED MAC OS X DIALOG TO SHOW UNTIL THE COMMAND IS 100% FINISHED!!! PLEASE HELP AND CREDITS WILL GO IN THE ABOUT BOX!!!
To answer your question:
As AppleScript is single-threaded by default, you need a second thread to perform the shell script asynchronously.
In (AS)ObjC this can be done with NSTask, NSPipe and NSFileHandle.
This is an example in Objective-C to display all output of a shell call asynchronously
I don’t think it is necessary to place code like this is in code exchange. diskutil is the cli version of disk utily application and they uses the same frameworks. SO if someone wants a GUI, use disk utiliy instead of terminal.
Then in unscripted I have posted how to make background processes and manage them.