我想编写一个AppleScript,允许我使用给定的库启动iTunes,而不必按住Option键并浏览一个。我已经知道道格的图书馆经理,这不是我想要的。 AppleScript将用于特定的库。Applescript用特定的库启动iTunes
5
A
回答
12
iTunes不允许您使用AppleScript来做到这一点,但您可以直接写入iTunes的偏好设置,在该偏好设置中存储当前所选库的别名(或者,如果您在默认情况下使用库位置)。
首先,您需要获取所选库位置的别名数据。按住Option键打开iTunes,选择您的音乐库并退出iTunes。然后在终端中运行:
defaults read com.apple.itunes 'alis:1:iTunes Library Location' | pbcopy
这会将库别名数据复制到剪贴板。
最后,这里的脚本:
property otherLibraryLocation : "" -- paste location between the quotes
property libraryLocationPref : "com.apple.iTunes 'alis: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
。
3
您可以创建一个从〜/ Music/iTunes到unix shell脚本(man ln)中所选目录路径的符号链接。而AppleScript可以通过发送适当的消息到终端应用程序来调用一个unix shell脚本。
相关问题
- 1. 使用Applescript将特定文件夹的内容导入到iTunes
- 2. Applescript iTunes Reveal
- 3. AppleScript在iTunes中与特定艺术家一起播放歌曲?
- 4. 没有applescript脚本的iTunes?
- 5. 从javascript启动applescript
- 6. 已启动iTunes的通知
- 7. 通过AppleScript获取独特的iTunes艺术家列表
- 8. 如何使用Applescript搜索iTunes?
- 9. 用AppleScript重命名iTunes文件
- 10. iTunes AppleScript:查询包含特定曲目的所有播放列表
- 11. Applescript无法启动应用程序
- 12. 使用AppleScript启动Xcode项目
- 13. 从iTunes启动应用程序
- 14. Simplepie iTunes选择特定类
- 15. 启用特定布局的滚动
- 16. 用特定的URL启动UIWebview
- 17. 确定应用程序是否从AppleScript启动
- 18. QTimer启动特定时间
- 19. AppleScript iTunes:按位置选择文件?
- 20. AppleScript:搜索Google for iTunes歌词
- 21. 如何用emacs启动特定模式?
- 22. AppleScript启用编辑框
- 23. 如何使用applescript搜索itunes商店的应用程序?
- 24. Android使用特定浏览器启动特定网址
- 25. AppleScript启动并循环播放视频?
- 26. Applescript在OSX启动时无法运行
- 27. 选择iTunes中的所有曲目使用AppleScript
- 28. 使用AppleScript将路径更改为iTunes中的文件
- 29. 如何使用AppleScript在iTunes中计算已检查的项目
- 30. AppleScript:如何让AppleScript在按特定键时说出选定的短语?
仍然适用于10.8.4! – Scot 2013-08-05 00:39:12
不错!我想它会最终破裂,因为别名已被废弃,但在此期间... – 2013-08-06 00:28:00
仍然在10.11.1工作! :d – Kametrixom 2015-11-28 23:26:36