注册为 Cocoa 的登录项? [英] Register as Login Item with Cocoa?

查看:17
本文介绍了注册为 Cocoa 的登录项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google 给了我:http://developer.apple.com/samplecode/LoginItemsAE/index.html

Google gave me: http://developer.apple.com/samplecode/LoginItemsAE/index.html

而且我认为一定有比使用 AppleScript 事件更好的方法.

And I figured there must be a better way than using AppleScript Events.

所以我下载了 Growl 源代码.他们使用了 Apple 开发者文章中的确切来源.

So I downloaded the Growl sources. They use the exact sources from that Apple developer article.

有更好的方法吗?

(我指的是系统偏好设置中帐户中的登录项,即以编程方式让我的程序在用户登录时启动)

(I refer to Login Items in Accounts in System Preferences, ie. making my program start when the user Logs in, programmatically)

推荐答案

Leopard 中有一个名为 LSSharedFileList 的新 API.它允许您执行的其中一项操作是查看和编辑登录项列表(在该 API 中称为会话登录项).

There's an API that's new in Leopard called LSSharedFileList. One of the things it lets you do is view and edit the Login Items list (called Session Login Items in that API).

顺便说一句,我是 Growl 的首席开发人员.我们还没有放弃 AE,因为我们仍然需要 Tiger,但我正在考虑在 1.2 中放弃它(还没有与其他开发人员讨论过).当我们删除 Tiger 时,我们也会删除 LoginItemsAE,并切换到共享文件列表 API.

BTW, I'm the lead developer of Growl. We haven't switched away from AE yet because we still require Tiger, but I'm thinking of dropping that for 1.2 (haven't talked it over with the other developers yet). When we do drop Tiger, we'll drop LoginItemsAE as well, and switch to the Shared File List API.

EDIT 从 2012 年开始:自 2009 年起,当我最初编写此答案时,Growl 已切换到 LSSharedFileList,我已离开该项目.

EDIT from the year 2012: Since 2009, when I originally wrote this answer, Growl has switched to LSSharedFileList and I've left the project.

这篇关于注册为 Cocoa 的登录项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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