• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Login Item
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Login Item


  • Subject: Re: Login Item
  • From: Nir Soffer <email@hidden>
  • Date: Thu, 29 Jun 2006 01:00:19 +0300


On 28/06/2006, at 21:33, Nir Soffer wrote:

With this level of brokeness - how about this little hack: get the application dock menu, get the "Open at Login" menu item, and perform its selector - as if the user click it :-)

Unfortunately, I could not find how to get the default application dock menu.


Anyway, its very easy to do this with few lines of AppleScript - works nicely here on 10.4.6, I wonder if this script suffer from the same problems mentioned earlier.

on |add login item with path|(posixPath)
tell application "System Events"
make new login item at end of login items with properties {kind:"Application", path:posixPath}
end tell
end |add login item with path|


on |remove login item with path|(posixPath)
	tell application "System Events"
		set theMatches to login items whose path is posixPath
		if theMatches is {} then return
		delete item 1 of theMatches
	end tell
end |remove login item with path|

-- simple test
|add login item with path|("/Applications/Mail.app")
|remove login item with path|("/Applications/Mail.app")


Best Regards,

Nir Soffer

_______________________________________________
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


  • Follow-Ups:
    • Re: Login Item
      • From: Jerry Krinock <email@hidden>
References: 
 >Re: Login Item (From: Jerry Krinock <email@hidden>)
 >Re: Login Item (From: Nir Soffer <email@hidden>)

  • Prev by Date: Re: Executing non objective-c code in a loaded bundle
  • Next by Date: Re: Implementing a TCP port listener in Cocoa
  • Previous by thread: Re: Login Item
  • Next by thread: Re: Login Item
  • Index(es):
    • Date
    • Thread