如何使用AppleScript下载文件?

时间:2011-09-02 07:50:49

标签: applescript

类似的东西:

set the file_tgt to (path to downloads as string) as file specification
    set file_src to "http://my_file.png"
    tell application "URL Access Scripting"
        download file_src to file_tgt
    end tell
  1. 如何获取用户的默认下载文件夹的路径?
  2. AppleScript不喜欢路径转换。我该如何解决这个问题?

2 个答案:

答案 0 :(得分:2)

我自己找到了解决方案:

  1. Use "path to downloads folder"
  2. set the file_tgt to (path to downloads folder as string) & "file.png"

答案 1 :(得分:0)

使用applescript和shell脚本下载目录中托管的文件集合 -

set counter to 0
repeat 36 times
    do shell script "curl -f 'http://stage.omatics.com/Images/Devices/Devices/" & counter & ".png' -o ~/Desktop/" & counter & ".png"
    set counter to counter + 10
    delay 2
end repeat

这将下载这36个文件

http://stage.omatics.com/Images/Devices/Devices/0.png
http://stage.omatics.com/Images/Devices/Devices/10.png
http://stage.omatics.com/Images/Devices/Devices/20.png
--
--
http://stage.omatics.com/Images/Devices/Devices/350.png

在桌面上。

希望这有帮助。