Antes podía descargar URLs desde un Applescript, pero he perdido el Applescript. Quiero introducir una URL: por ejemplo: "http://wpclassic.com/go.php?http://www.revolutiontwo.com/download/tv.zip" y que me pida un lugar para poner el archivo.
Respuesta
¿Demasiados anuncios?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). Utilice el comando del 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 ""