Applescript可以列出放置在扩展坞中的所有应用程序吗? [英] Can Applescript list all the applications placed in the dock?

查看:77
本文介绍了Applescript可以列出放置在扩展坞中的所有应用程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道如何列出用户放置在扩展坞中的所有应用程序.

I can't work out how to list all the Applications that a user has placed in the dock.

这可能吗?

推荐答案

尝试一下.这是一个人在扩展坞中永久存在的应用程序的列表.我基本上所做的是使用系统事件将plist文件读入pListItems变量中的applescript记录.然后,我可以使用applescript技术来访问pListItems内部的列表和记录.

Try this. This is a list of the apps a person has that are persistent in the dock. What I've basically done is use system events to read the plist file into an applescript record in the pListItems variable. Then I can use applescript techniques to access the lists and records inside of pListItems.

com.apple.dock中有很多信息,因此您可以查看pListItems变量并逐步处理该变量以提取所需的内容.例如,您可能需要"| bundle-identifier |"而不是"| file-label |".祝你好运.

There's lots of information in com.apple.dock so you can look at the pListItems variable and work your way through it to pull out whatever you need. For example you might want the "|bundle-identifier|" instead of the "|file-label|". Good luck.

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

这篇关于Applescript可以列出放置在扩展坞中的所有应用程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆