Re: Agent Applications and launchd
Re: Agent Applications and launchd
- Subject: Re: Agent Applications and launchd
- From: Alberto Ricart <email@hidden>
- Date: Tue, 3 Jan 2006 10:23:07 -0600
No I didn't look at the read me file. I simply looked at the code.
While the applescript solution is indeed reasonable, it still
requires knowing about applescript to find how to iterate and query
properties so that you can find an index and implement remove. Which
introduces yet another mission when all you really want to do is just
make a one liner type of call.
Essentially there's a gap in the API which is patched with an either
very long solution, or a solution requiring apple scripting abilities.
A 'NSRegisterLoginItem(myPath, NO)' would be a better solution, and
require far less running around and less documentation.
Thanks John, for pointing me at the obvious.
/a
tell application "System Events"
make new login item at end
with properties {path:"/Applications/TextEdit.app",
hidden:false}
end tell
tell application "System Events"
properties of every login item
end tell
tell application "System Events"
delete login item 1
end tell
On Jan 3, 2006, at 9:44 AM, John Stiles wrote:
Alberto Ricart wrote:
On Dec 31, 2005, at 5:23 AM, j o a r wrote:
then perhaps you shouldn't be using CFPreferences either? Who
knows how many lines of code it's made up of? ;-)
The question is not the depth of the code path, but who the owner
of the code is. The 800 line solution would lie on my side (as in
it would need to be supported by me even if with support from the
great folks at dts). My whole point is that the supported way is
ridiculous - "autolaunch foo" is a simple request and shouldn't
take more than 5 lines of code to specify - heck I bet the whole
autolaunch functionality doesn't have that much code.
Have you read the accompanying docs? Or did you just get a ruler
out, measure the code, and decide you didn't like it? :)
Seriously, the AppleScript version is about 5 lines of code. It is
truly trivial.
The "800 lines of code" you keep harping on about is the C code
necessary to synthesize this AppleScript with raw AppleEvents.
AppleEvent code has always been bulky, but that's been an issue
since System 7.0--get used to it :) It is highly unlikely to
require changes in the future.
You have options if you want to make it smaller. For instance, you
can always embed the AppleScript in your code and compile and run
it on the fly (see OSACompile/OSAExecute). Or you can redesign the
code to use AEBuildAppleEvent, which makes the code a lot tighter
(but a little harder to read in some cases).
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden