使用 AppleScript 运行另一个应用程序而不在 Dock 上显示它 [英] Run another application using AppleScript without showing it on the dock

查看:36
本文介绍了使用 AppleScript 运行另一个应用程序而不在 Dock 上显示它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 AppleScript,您可以创建运行另一个应用程序的脚本,然后将该脚本本身另存为应用程序并将其放置在 Dock 中.问题(不是真正的问题)是当您单击它时,它仍然会在 Dock 上显示其他应用程序.是否可以阻止其他应用程序显示在 Dock 中,但仍像通常执行时那样显示其 GUI?

Using AppleScript you can create a script that runs another application, and then save that script itself as an application and place it in the dock. The problem (not really a problem) is that when you click it, it will still show the other application on the dock. Is it possible to prevent the other application from showing in the dock, yet show its GUI as it would normally do when executed?

谢谢

推荐答案

我能想到的唯一解决方案是实际修改其他应用程序"使其没有 Dock 图标.它有效,但很讨厌:
•是的,您正在直接修改另一个应用程序,而不是从您的脚本中执行某些操作.
•因此,它会改变所述其他应用程序的每次启动,而不仅仅是从您的脚本调用.
•它阻止OtherApp 有菜单栏(尽管组合键和任何窗口内控件仍然有效).

The only solution I can think of is to actually modify the 'other app' to have no Dock icon. It works, but it's nasty:
•Yep, you're directly modifying the other app—not doing something from your script.
•Accordingly, it will change every launch of said other app, not just invocation from your script.
•It prevents OtherApp from having a menubar (though key combos and any in-window controls will still work).

虽然很容易逆转,并且几乎总是可以通过向应用程序的 Info.plist 文件添加 GUI 模式标志来完成:

It's easily reversed though, and can almost always be done just by adding a GUI mode flag to the app's Info.plist file:

  1. 右键或 Ctrl 键单击另一个应用程序,然后选择显示包内容"
  2. 打开内容"文件夹
  3. 在您选择的 text/xml 编辑器中打开 Info.plist*
  4. 在第一行
    之后添加这两行NSUIElement
  5. 保存,然后启动应用程序.记住…没有菜单栏,因此请确保其中一个窗口具有焦点并在您确认它在没有 Dock 图标的情况下运行时退出 -Q.

*如果您不喜欢编辑 xml,或者 plist 文件是二进制文件,则您需要专用的 plist 编辑器.Apple 自己的属性列表编辑器包含在其免费的开发工具中.

*If you're squeamish with editing xml, or if the plist file is the binary variety, you'll need a dedicated plist editor. Apple's own Property List Editor is included with their free Dev Tools.

  1. 将子项添加到根(信息属性列表").
  2. 将名称设置为 NSUIElement.
  3. 从编辑(或上下文)菜单中,将值类型设置为布尔值.
  4. 点击复选框 ON(将 bool 设置为 true).

这篇关于使用 AppleScript 运行另一个应用程序而不在 Dock 上显示它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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