Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在通过 AppleScript 控制 iTunes(在 OSX 上),并且想知道用户何时更改音量或暂停歌曲等内容。除了通过 AppleScript 轮询外,知道如何做到这一点吗?
iTunes 会发出系统范围的通知,以便在发生更改时通知应用程序。Cocoa 应用程序可以注册以接收此通知,但标准的 applescript 不能。因此,您最好的选择是使用 ApplescriptObjC 或 Objective-c 在 Xcode 中开发您的应用程序。
仅供参考:如果您走到那一步,则通知称为“com.apple.iTunes.playerInfo”,并且您从 NSDistributedNotificationCenter 获得它。
所以基本上你唯一的选择是从 applescript 轮询 iTunes。