我想编写一个 AppleScript,它允许我使用给定的库启动 iTunes,而不必按住 Option 键并浏览某个库。我已经知道道格的图书馆经理,但这并不是我想要的。 AppleScript 将用于特定的库。
iTunes 不允许您使用 AppleScript 执行此操作,但您可以直接写入 iTunes 的首选项,其中它会将书签(别名)存储到当前选定的资料库(如果您在默认位置使用资料库,则什么也不存储) )。
首先,您需要获取所选图书馆位置的别名数据。按住 Option 键打开 iTunes,选择您的资料库并退出 iTunes。然后,在终端中运行:
defaults read com.apple.itunes 'book:1:iTunes Library Location' | pbcopy
这会将库别名数据复制到剪贴板。
最后,这是脚本:
property otherLibraryLocation : "" -- paste location between the quotes
property libraryLocationPref : "com.apple.iTunes 'book:1:iTunes Library Location'"
-- first, quit iTunes if it's running
tell application "System Events"
if exists (application process "iTunes") then
tell application "iTunes" to quit
end if
end tell
-- then, set the location
do shell script "defaults write " & libraryLocationPref & " " & quoted form of otherLibraryLocation
-- uncomment the following line to use the default iTunes library instead
-- do shell script "defaults delete " & libraryLocationPref
-- finally, relaunch iTunes
tell application "iTunes" to activate
将库位置粘贴到脚本第一行的引号之间,您就应该完成所有设置了。要返回到原始库,请取消注释该行,包括defaults delete
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)