0
A
回答
2
試試這個。這是一個人在碼頭中持久存在的應用程序列表。我基本上所做的就是使用系統事件將plist文件讀入pListItems變量的applescript記錄中。然後我可以使用applescript技術訪問pListItems中的列表和記錄。
com.apple.dock中有很多信息,因此您可以查看pListItems變量並按照自己的方式通過它來取出您需要的任何內容。例如,您可能需要「| bundle-identifier |」而不是「| file-label |」。祝你好運。
set plistpath to (path to preferences folder as text) & "com.apple.dock.plist"
tell application "System Events"
set plistContents to contents of property list file plistpath
set pListItems to value of plistContents
end tell
set persistentAppsList to |persistent-apps| of pListItems
set dockAppsList to {}
repeat with thisRecord in persistentAppsList
set end of dockAppsList to |file-label| of |tile-data| of thisRecord
end repeat
return dockAppsList
2
添加到由regulus6633作爲響應的建議,使用|bundle-identifier|
確實讓在這個腳本更可靠的結果。例如,由於Evernote.app和EvernoteHelper.app具有相同的短名稱(CFBundleName
),因此Evernote不會正確識別所有AppleScript使用中的|file-label|
屬性。
其他想法我用這個腳本作爲啓動永久放置在碼頭中的所有應用程序('Keep in dock'選項)的基礎。我刪除了dockAppsList數組並替換了第二個循環來激活所有這些應用程序。爲了避免窗戶濺滿我的屏幕,我保持appName
並使用它在激活應用程序後立即隱藏它們。
要調整,該end tell
語句下面替換後的代碼:
repeat with thisRecord in |persistent-apps| of pListItems
set appName to |file-label| of |tile-data| of thisRecord
set appID to |bundle-identifier| of |tile-data| of thisRecord
tell application id appID to activate
tell application "Finder" to set visible of process appName to false
end repeat
相關問題
- 1. Applescript - 列出所有正在運行的應用程序
- 2. AppleScript的 - 列出所有隱藏的窗口在碼頭 - 微型
- 3. 使用Applescript退出所有應用程序?
- 4. AppleScript - 列出所有字體
- 5. 谷歌上的所有Android應用程序的列表播放
- 6. 在碼頭上使用AppleScript爲應用程序添加自定義菜單項
- 7. 在網頁上列出安裝在遠程PC上的所有應用程序
- 8. iOS 11列出所有應用程序
- 9. 在Mac上的Java應用程序中播放swf可能嗎?
- 10. 如何使用AppleScript關閉所有隱藏的應用程序?
- 11. 列出所有可用的語言在Android應用程序
- 12. 不能在谷歌找到應用程序在所有設備上播放
- 13. 無法退出AppleScript應用程序
- 14. 如何列出使用Python 2.7安裝在Mac上的所有應用程序?
- 15. 如何列出Azure功能應用程序中的所有功能
- 16. 使用C++在Windows上列出所有安裝的程序
- 17. 列出所有引用的程序集
- 18. 一個移動應用程序在所有平臺上運行。那可能嗎?
- 19. Android列出所有具有相機權限的應用程序
- 20. Applescript通用應用程序
- 21. 在Play/AppStore上列出同一個帳戶下的所有應用程序
- 22. 試圖列出安裝在64位機器上的所有應用程序
- 23. 是否有Facebook API調用列出所有應用程序?
- 24. 如何使用AppleScript列出列表中項目的所有可能性?
- 25. 應用程序沒有出現在應用程序列表中?
- 26. IOS Objective-C使所有「開放」應用程序出現
- 27. 列出所有正在運行的應用程序MASM32程序集
- 28. 列出來自Qlikview和Qliksense的所有可用應用程序?
- 29. 列出SendBird應用程序中可用的所有通道
- 30. 將應用程序代碼放在QT應用程序上的位置?
真棒。這正是我想要的。謝謝。 – dompardoe