Re: download file with curl and then launch it
Re: download file with curl and then launch it
- Subject: Re: download file with curl and then launch it
- From: jj <email@hidden>
- Date: Thu, 27 Jan 2005 10:00:45 +0100
> what is the proper way to download a file...wait for it to
> complete...and then launch it ?
>
>
> set the_command to "curl " & remoteFile & " -o " & quotes &
> localFile_posixPath & quotes
> do shell script the_command
Exactly what you wrote. If you need, though, a progress-bar (eg, a large
file), you may consider Emmanuel's way. Eg (more tiny in a real progress
bar):
################################################
set remoteFile to "http://server/FILE.DMG"
set fLength to (do shell script "curl -I " & quoted form of remoteFile & " |
grep -e 'Content-Length:' | awk '{print $2}'") as number
--> execute ignoring responses
do shell script "cd ~/Desktop; curl -O " & quoted form of remoteFile & " >
/dev/null 2>&1 &"
--> monitorize
repeat
try
set fSize to (do shell script "wc -c ~/Desktop/FILE.DMG | awk
'{print $1}'")
display dialog "Downloaded " & (fSize / 1024) & " kb..." giving up
after 1 with icon note
if (fSize as number) is fLength then exit repeat
end try
end repeat
################################################
jj
--
http://www.macscripter.net/
http://www.osaxen.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden