Ero abituato a scaricare URL da un file Applescript, ma ho perso Applescript. Voglio inserire un URL: es .: "http://wpclassic.com/go.php?http://www.revolutiontwo.com/download/tv.zip" e chiedergli un posto dove mettere il file.
Ero abituato a scaricare URL da un file Applescript, ma ho perso Applescript. Voglio inserire un URL: es .: "http://wpclassic.com/go.php?http://www.revolutiontwo.com/download/tv.zip" e chiedergli un posto dove mettere il file.
set the URLs to the text returned of (display dialog "Enter the URLs you would like to download. If you have more than one, separate them with commas please:" default answer "")
set the destination to (choose folder with prompt "Choose the folder you want to download the URLs to:")
set AppleScript's text item delimiters to ","
repeat with this_URL in the URLs
tell application "URL Access Scripting" to download this_URL to the destination with progress and unpacking
end repeat
set AppleScript's text item delimiters to ""
Se utilizzi Lion, il codice sopra riportato non funzionerà (Apple ha rimosso URL Access Scripting
per qualche motivo). Usa invece il comando di shell curl
, come mostrato di seguito:
set the URLs to the text returned of (display dialog "Enter the URLs you would like to download. If you have more than one, separate them with commas please:" default answer "")
set the destination to (choose folder with prompt "Choose the folder you want to download the URLs to:")
set AppleScript's text item delimiters to ","
repeat with this_URL in the URLs
do shell script "curl -L " & this_URL & " -o " & POSIX path of the destination
end repeat
set AppleScript's text item delimiters to ""
Leggi altre domande sui tag applescript