使用 AppleScript 运行另一个应用程序而不将其显示在 Dock 上
使用 AppleScript,您可以创建运行另一个应用程序的脚本,然后将该脚本本身另存为应用程序并将其放置在 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?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我能想到的唯一解决方案是实际修改“其他应用程序”以使其没有 Dock 图标。它有效,但很糟糕:
•是的,您直接修改其他应用程序,而不是通过脚本执行某些操作。
•因此,它将改变所述其他应用程序的每次启动,而不仅仅是从您的脚本中进行调用。
•它阻止其他应用程序拥有菜单栏(尽管按键组合和任何窗口内控件仍然有效)。
不过,它很容易逆转,并且几乎总是可以通过添加 GUI 模式来完成标记到应用程序的 Info.plist 文件:
之后
*如果您对编辑 xml 感到厌烦,或者 plist 文件是二进制文件,则您将需要一个专用的 plist 编辑器。 Apple 自己的属性列表编辑器包含在其免费的开发工具中。
NSUIElement
。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).
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:
<dict>
<key>NSUIElement</key>
<true/>
*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.
NSUIElement
.构建之前的答案——您可以使用相同的 XML 代码修改 Applescript 应用程序的 Info.plist。这将阻止 Applescript 应用程序显示图标(并且有一个菜单栏,根据我的经验,对于这种类型的“应用程序”而言,菜单栏无论如何都无法使用),但是您的主应用程序(您从 applescript 启动的应用程序)将像往常一样显示在 Dock 中。
我在 OSX 10.7 Lion 上尝试过,它成功了。
Building off the previous answer -- you can modify the Info.plist of your Applescript application with the same XML code. This will prevent the Applescript app from displaying an icon (and having a menubar, which in my experience is unusable anyway for this type of 'app'), but your main application -- the one you're launching from the applescript -- will display in the Dock as usual.
I tried this on OSX 10.7 Lion and it worked successfully.