• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: download file with curl and then launch it
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >download file with curl and then launch it (From: Graham Anderson <email@hidden>)

  • Prev by Date: Re: Unpack and pack .gz files.
  • Next by Date: Re: Unpack and pack .gz files.
  • Previous by thread: Re: download file with curl and then launch it
  • Next by thread: Re: iWork Pages
  • Index(es):
    • Date
    • Thread