macos - 在 os x mavericks (10.9) 中从 applescript 设置桌面照片

标签 macos applescript

我正在尝试使用 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/

相关文章:

applescript - applescript 是一种死语言吗?

stream - 在 OSX 上通过 AppleScript 使用 iTunes 打开 URL

windows - AppleScript 获取窗口的标题

C fork() 使一个进程一次读取文件

node.js - Microsoft Azure Functions 和 Node - 我是 Mac 用户。如何在 Azure 门户中上传/安装 Node 包?

objective-c - 有没有办法使用 AppleScript 单击 osx 菜单项而不访问 "System Events"?

macos - 在终端/脚本中确定 OS X 键盘布局 ("input source")?

objective-c - 对象有效时 NSDictionary writeToFile 失败,权限为 0k

Mac 上的 Java

objective-c - NSWindowController 子类不会在 ARC 中发布