以编程方式添加应用程序图标以在安装时停靠 [英] Programmatically add application icon to dock on install

查看:63
本文介绍了以编程方式添加应用程序图标以在安装时停靠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在安装软件包(DMG)之后将我的应用程序自动添加到扩展坞中吗?

I would like my application to be automatically added to the dock after the package (DMG) is installed?

有人知道该怎么做吗?

推荐答案

有两种方法可以做到这一点,安德鲁(Andrew),而这很多取决于您如何安装应用程序.

There's a couple ways to do this, Andrew, and a lot of this depends on how you're doing your application installing.

如果您使用PackageMaker安装应用程序,则可以运行"postflight"脚本,该脚本会将您应用程序的图标添加到扩展坞的默认值"(即首选项)中. 这个较旧的MacRumors线程演示了如何做到这一点.

If you are using PackageMaker to install your app, you can run a "postflight" script which adds your app's icon to the "defaults" (i.e. the preferences) of the dock. This older MacRumors thread shows how to do that.

如果您没有使用PackageMaker,则可能必须从您的应用程序中运行执行相同默认值"编写技巧的Applescript. 这是AskDifferent上的一个线程,显示了如何.

If you are not using PackageMaker, then you might have to run an Applescript from within your app that does the same "defaults" writing trick. Here's a thread on AskDifferent that shows how.

在两种情况下,您都需要杀死扩展坞(或Finder?)并重新启动它,以使更改生效并显示.

In both cases you need to kill the dock (or Finder?) and restart it in order to get the change to pick up and show.

这篇关于以编程方式添加应用程序图标以在安装时停靠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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