curl (download) and progress indicators

Heya I wonder if anyone can help me,
I’m writing a program which downloads a file ‘http://amsn.sourceforge.net/amsn_cvs.tar.gz’ which is about 4mb and then decompresses the file, and moves the content into an application bundle. The startprogress() function works absolutely fine, but when I run this, the window freezes completely, and the progress indicator won’t start until the file has finished downloading. Have any of you applescript wizards got any ideas on how I can download the file, find out when it has finished downloading, and then do the installCVS() function?
Any ideas will be greatly appreciated,
Tom

on updateaMSN()
	startprogress()
	tell window "mainWindow"
		set contents of text field "statusText" to "Downloading Latest CVS."
	end tell
	do shell script "/usr/bin/curl -L -f -# -o ~/.amsn.tar.gz http://amsn.sourceforge.net/amsn_cvs.tar.gz > /dev/null"
	installCVS()
end updateaMSN

when you tell the progress indicator to use threaded animation before you tell it to start.

tell progress indicater "whatever"
	set threaded animation to true
	start
end tell

The problem is the do shell script command.
Apple Script wil wait until the do shell script command is finished until it goes further.

To solve this run the shell script in the background like this:


   do shell script "/usr/bin/curl -L -f -# -o ~/.amsn.tar.gz http://amsn.sourceforge.net/amsn_cvs.tar.gz > /dev/null 2>&1 & echo $!"
   set PID to the result

This way all the outcome will go to /dev/null. To only thing AppleScript is getting back now is the proces id (pid).
You could later on check if the proces is still running by doing something like this:


do shell script "ps -p " & PID & " | grep -v PID | awk '{print $1}'"
set PIDCHECK to the result
if CPPID = PIDCHECK then
	delay 5
else
         exit repeat
end if