Applescript - 列出所有正在运行的应用程序
我如何才能按照在 applescript 中执行 ⌘ + ⇥ 时出现的相同顺序获取正在运行的应用程序列表?
即,如果我使用 TextEdit,然后 Preview,然后 iCal,顺序是
iCal、Preview、TextEdit
这个问题询问是否有一个 API 可以生成此列表并提供此答案:
$ cd /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework
$ nm LaunchServices | grep __LSCopyApplicationArrayInFrontToBackOrder
但是如何从 applescript 中访问此列表?
How can i get a list of running applications in the same order they appear when doing ⌘ + ⇥ from within an applescript?
I.e. if I use TextEdit, then Preview, then iCal, the order is
iCal, Preview, TextEdit
This question which asked if there was an API that could produce this list provided this answer:
$ cd /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework
$ nm LaunchServices | grep __LSCopyApplicationArrayInFrontToBackOrder
But how can I access this list from within an applescript?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
告诉应用程序“系统事件”获取每个进程的名称
它看起来对我来说是按启动日期排序的,但我不知道这是否可靠。
至于使用 SO 的答案:您必须在(目标)-C 中创建一个小程序(或 OSAX)来访问该例程,使该程序可编写脚本,然后从脚本中调用该程序/OSAX。
tell application "System Events" to get name of every process
It looks sorted by launch date to me, but I don't know if that's reliable or not.
As for using the answer from SO: you would have to create a small program (or OSAX) in (Objective)-C to access that routine, make the program scriptable, then call that program/OSAX from your script.
不确定如何订购它们但这列出了不仅仅是后台的应用程序
Not sure as how to order them But this lists applications that are not background only