Applescript 使用特定库启动 iTunes
我想编写一个 AppleScript,它允许我使用给定的库启动 iTunes,而不必按住 Option 键并浏览某个库。我已经知道道格的图书馆经理,但这并不是我想要的。 AppleScript 将用于特定的库。
I would like to write an AppleScript that would allow me to launch iTunes with a given Library instead of having to hold down the Option key and browsing for one. I'm already aware of Doug's Library manager, which is not quite what I want. The AppleScript would be for a specific library.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
iTunes 不允许您使用 AppleScript 执行此操作,但您可以直接写入 iTunes 的首选项,其中它会将书签(别名)存储到当前选定的资料库(如果您在默认位置使用资料库,则什么也不存储) )。
首先,您需要获取所选图书馆位置的别名数据。按住 Option 键打开 iTunes,选择您的资料库并退出 iTunes。然后,在终端中运行:
这会将库别名数据复制到剪贴板。
最后,这是脚本:
将库位置粘贴到脚本第一行的引号之间,您就应该完成所有设置。要返回原始库,请取消注释包含
defaults delete
的行。iTunes doesn't allow you to do this with AppleScript, but you can write directly into iTunes' preferences, where it stores a bookmark (alias) to the currently selected library (or nothing, if you're using a library in the default location).
First, you'll need to obtain the alias data for your selected library location. Open iTunes holding down the Option key, select your library and quit iTunes. Then, in Terminal, run:
This will copy the library alias data to the clipboard.
Finally, here's the script:
Paste the library location between the quotes in the first line of the script, and you should be all set. To return to the original library, uncomment the line including
defaults delete
.您可以在 unix shell 脚本 (man ln) 中创建从 ~/Music/iTunes 到您选择的目录路径的符号链接。 AppleScript 可以通过向终端应用程序发送适当的消息来调用 unix shell 脚本。
You can create a symlink from ~/Music/iTunes to your chosen directory path in a unix shell script (man ln). And an AppleScript can call a unix shell script by sending the appropriate message to the Terminal app.