¿Cómo descargo una URL usando Applescript?

1

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.

    
pregunta daviesgeek 08.08.2011 - 21:03

1 respuesta

5
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 ""
    
respondido por el fireshadow52 10.08.2011 - 04:17

Lea otras preguntas en las etiquetas