Macos 通过AppleScript更改Mac壁纸

Macos 通过AppleScript更改Mac壁纸,macos,applescript,wallpaper,Macos,Applescript,Wallpaper,我试图指定一个jpg文件作为特定桌面的墙纸,但它似乎不起作用。。。相反,它将背景更改为另一个完全不同文件夹中的图像。。。有人知道怎么修吗 tell application "System Events" tell current desktop set picture to "/Downloads/yosemite-5796x3531-5k-4k-wallpaper-el-capitan-forest-osx-apple-3962.jpg" end tell end tell作为参数传

我试图指定一个jpg文件作为特定桌面的墙纸,但它似乎不起作用。。。相反,它将背景更改为另一个完全不同文件夹中的图像。。。有人知道怎么修吗

tell application "System Events"
tell current desktop
    set picture to "/Downloads/yosemite-5796x3531-5k-4k-wallpaper-el-capitan-forest-osx-apple-3962.jpg"
end tell

end tell

作为参数传递的路径不正确。在硬盘的根级别没有
/Downloads
文件夹。你的意思可能是:

"/Users/yourusernamehere/Downloads/example.jpg"

作为参数传递的路径不正确。在硬盘的根级别没有
/Downloads
文件夹。你的意思可能是:

"/Users/yourusernamehere/Downloads/example.jpg"

在high sierra上进行测试,将路径替换为您喜欢的任何路径

tell application "System Events" to set picture of (reference to current desktop) to "/Library/Desktop Pictures/Sierra 2.jpg"

在high sierra上进行测试,将路径替换为您喜欢的任何路径

tell application "System Events" to set picture of (reference to current desktop) to "/Library/Desktop Pictures/Sierra 2.jpg"