我有以下以前工作的 Applescript 代码,但现在我收到错误:预期的“给定”、“in”、“of”、表达式、“with”、“without”、其他参数名称等,但发现未知的令牌。是某种权限问题吗?
do shell script 'curl -L -o "/Users/myUserName/Desktop/newimagename.jpg" "https://somewebsite.com/files/gallery/1676041915.jpg"'
我期待图像以新名称下载到我的桌面。我已确认 jpg 的网站网址有效。
这里的引号有问题。外引号用于 AppleScript 语言的 do shell script 命令(更准确地说,它的标准添加项),它们必须是 double (")。而 single quotes (') 用于 shell 命令,这也是 curl 命令。
也就是说,你需要交换它们:
do shell script "curl -L -o '/Users/myUserName/Desktop/newimagename.jpg' 'https://somewebsite.com/files/gallery/1676041915.jpg'"
其他,更好的选择是对提供的路径使用引用形式的。