Solía ser capaz de descargar URL desde un Applescript, pero perdí el Applescript. Quiero ingresar una URL: es decir, "http://wpclassic.com/go.php?http://www.revolutiontwo.com/download/tv.zip" y pedirle un lugar para colocar el archivo.
Solía ser capaz de descargar URL desde un Applescript, pero perdí el Applescript. Quiero ingresar una URL: es decir, "http://wpclassic.com/go.php?http://www.revolutiontwo.com/download/tv.zip" y pedirle un lugar para colocar el archivo.
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 ""
Si está utilizando Lion, el código anterior no funcionará (Apple eliminó URL Access Scripting
por alguna razón). Use el comando de shell curl
en su lugar, como se muestra a continuación:
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 ""
Lea otras preguntas en las etiquetas applescript