Kyl*_*yes 5 macos applescript itunes
我想编写一个AppleScript,它允许我使用给定的库启动iTunes,而不必按住Option键并浏览一个.我已经知道了Doug的图书馆经理,这不是我想要的.AppleScript将用于特定的库.
Nic*_*ley 12
iTunes不允许您使用AppleScript执行此操作,但您可以直接写入iTunes的首选项,它将书签(别名)存储到当前选定的库中(如果您在默认位置使用库,则不显示任何内容) ).
首先,您需要获取所选库位置的别名数据.打开iTunes按住Option键,选择您的库并退出iTunes.然后,在终端中,运行:
defaults read com.apple.itunes 'book:1:iTunes Library Location' | pbcopy
Run Code Online (Sandbox Code Playgroud)
这会将库别名数据复制到剪贴板.
最后,这是脚本:
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
Run Code Online (Sandbox Code Playgroud)
将库位置粘贴到脚本第一行的引号之间,您应该全部设置.要返回原始库,请取消注释该行defaults delete.
| 归档时间: |
|
| 查看次数: |
5622 次 |
| 最近记录: |