如何使用AppleScript下载文件?

如何使用AppleScript下载文件?,applescript,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 如何为用户获取默认下载文件夹的路径 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
  • 如何为用户获取默认下载文件夹的路径
  • AppleScript不喜欢路径转换。我怎样才能解决这个问题

  • 我自己找到了解决办法:

  • 将文件设置为(下载文件夹的路径为字符串)&“file.png”

  • 使用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
    
    在你的桌面上

    希望这有帮助