我正在尝试使用 applescript 在 OS X 中设置桌面图片。
此代码在 10.6-10.8 中有效,但在 Mavericks (10.9) 中被破坏。
tell application "System Events"
tell current desktop
set picture to POSIX file "/development/desk/x.jpg"
end tell
end tell
我知道他们改变了多显示器的支持方式,但我不确定是什么破坏了这一点。
最佳答案
感谢 this github project这行得通。
也许 10.9 中不存在默认桌面的想法?
tell application "System Events"
set theDesktops to a reference to every desktop
repeat with x from 1 to (count theDesktops)
set picture of item x of the theDesktops to "/development/desk/x.jpg"
end repeat
end tell
关于macos - 在 os x mavericks (10.9) 中从 applescript 设置桌面照片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19566067/