How to give the user feedback to long "do shell" command

Hi, I’m setting up an Applescript so my girlfriend can sync the contents of her Desktop on her home computer to the Desktop on her Acer Aspire One, which I just installed Leopard on. She does all her current work on her home Desktop, so the idea is to sync up the Acer Desktop to her home Mac and she can have everything with her in the Acer.

I figured shell scripting rsync is the best way to go for speed and reliability, but since the process will take a while, I want her to be able to see progress, but I also didn’t want to have to get into XCode for a simple rsync. This is proving to be more difficult than I hoped.

First, the shell script (edited for privacy):

do shell script "mkdir /Volumes/teacupsync; mount -t afp afp://USER:PASS@ASPIREONE.local/USER  /Volumes/teacupsync; rsync -a -u --delete ~/Desktop/ /Volumes/teacupsync/Desktop/; umount /Volumes/teacupsync/
beep
display dialog "All done!" buttons {"Finish"} default button 1"

My first thought was, “Hell, just script the Terminal, plenty of feedback there.” So:


activate application "Terminal"
tell application "Terminal"
	do script "mkdir /Volumes/teacupsync; mount -t afp afp://USER:PASS@ASPIREONE.local/USER  /Volumes/teacupsync; rsync -a -u -v --delete --progress ~/Desktop/ /Volumes/teacupsync/Desktop/; umount /Volumes/teacupsync/"
end tell
beep
display dialog "All done!" buttons {"Finish"} default button 1

Problem here is that the script finishes up with a dialog, and now the display dialog command does not wait for rsync to finish, like it does with the simple “do shell script” command.

So searching around, I found this

http://forums.macosxhints.com/archive/index.php/t-85104.html

I’ve successfully written the rsync output to a text file:

do shell script "mkdir /Volumes/teacupsync; mount -t afp afp://USER:PASS@ASPIREONE.local/USER  /Volumes/teacupsync; rsync -a -u -v --delete --progress ~/Desktop/ /Volumes/teacupsync/Desktop/ &> ~/Desktop/log.txt; umount /Volumes/teacupsync/
beep
display dialog "All done!" buttons {"Finish"} default button 1"

But I’m not sure how to read and display that log file in a scrolling window without busting out XCode.

Thanks, I’m sure there’s something very simple I’m overlooking

Answered my own question!

Since I was unmounting at the end of the rsync command, I figured I could use that to see if the rsync was done. Works good so far:


set Finished to false
repeat while not Finished
	set IsItThere to do shell script "cd /Volumes/teacupsync; ls"
	if IsItThere does not contain "Music" then set Finished to true
end repeat