• 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: delete the entry from loginwindow.plist using command
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: delete the entry from loginwindow.plist using command


  • Subject: Re: delete the entry from loginwindow.plist using command
  • From: Mike Fischer <email@hidden>
  • Date: Wed, 30 Jan 2008 06:16:02 +0100

Am 30.01.2008 um 05:52 schrieb sunil prajapati:

How can I launch my application at login time for each user?
Because I know only one way that is loginwindow.plist. As u said loginwindow.plist is managed by system so don't do anything with this. So please suggest some other method to launch my application at login time.

Did you read the technote I referenced in my answer? Did you look at the sample code I mentioned? If not, please do so, as the answers are all there.


Also since the file "loginwindow.plist" is located in each users ~/ Library/Preferences/ folder modifying one (directly or as suggested by the technote and sample code) will not affect other users in any way. If you need to launch something for *any* user at login then the sample code will likely not help you. Instead you should carefully read the technote.

Since you did not state the actual (high-level) task you are trying to accomplish or the minimum system version you need to support I can't give any more advice than to read.


HTH Mike

PS. Please don't continue discussions off the mailing list. Others might be interested in the answers and others might chime in with useful tipps.

On Jan 30, 2008 2:31 AM, Mike Fischer <email@hidden> wrote:
Am 29.01.2008 um 21:07 schrieb "sunil prajapati" <email@hidden>:


> Hi Guys,
>
> I successfully entered my application in loginwindow.plist through
> command
> line. But unable to delete that entry.

Does this have anything to do with the topic of this mailing list?


> How to remove the my added entry from loginwindow.plist from > command line > or shells script?

First of all the loginwindow.plist is an implementation detail
managed by the system. You should not access it directly. You should
most definitely not modify this file!


>> From net I found one script which remove the entry from
> loginwindow.plist,but
> it remove whole entries from the plist.
>
> The command is:
>
> #!/bin/sh
> theApp="your app"
> nl=`echo "x" | tr 'x' '\34'` # what is the proper way to set ascii
> to a
> variable?
> aaa=`defaults read loginwindow AutoLaunchedApplicationDictionary`
> bbb=`echo -n "$aaa" | sed "s/^[()]$//;s/},/}$nl/" | tr '\n\34' '\00
> \n'| grep
> -va "$theApp" | tr '\n\00' ',\n' | sed 's/^,$//'`
> defaults write loginwindow AutoLaunchedApplicationDictionary "($bbb)"
>
> Waiting for helpful reply.


This is just one of the problems you encounter when accessing this
file directly. From your question it seems that you want to add and
remove Login Items, correct? As you probably noticed there are no
official APIs for this.

Depending on your needs you might consider either launchd(8)
(LaunchAgents, 10.5+ only). Or if you really need a Login Item then
you should use the Apple sanctioned method shown in the Sample Code
project 'LoginItemsAE' (<http://developer.apple.com/samplecode/
LoginItemsAE/index.html>). It's not an API but it get's the job done
in a way that is not totally broken and dangerous like your code above.


See: <http://developer.apple.com/technotes/tn2005/tn2083.html>


> -- > Thanks & Regards, > > Sunil Prajapati > Software Developer in Macintosh > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: http://lists.apple.com/mailman/private/macnetworkprog/ > attachments/20080129/ef606aa2/attachment.html

Anything other than plain-text e-mail without attachements doesn't
make it through the mailing list in many cases. So please use plain
test only.


HTH Mike -- Mike Fischer Softwareentwicklung, EDV-Beratung Schulung, Vertrieb Note: I read this list in digest mode! Send me a private copy for faster responses.




-- Thanks & Regards,

Sunil Prajapati
Software Developer in Macintosh

-- Mike Fischer Softwareentwicklung, EDV-Beratung Schulung, Vertrieb Note: I read this list in digest mode! Send me a private copy for faster responses.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: delete the entry from loginwindow.plist using command (From: Mike Fischer <email@hidden>)

  • Prev by Date: Re: delete the entry from loginwindow.plist using command
  • Next by Date: Porting Winsock DHCP Server; is OS/X ignoring Broadcast UDP in recvall()?
  • Previous by thread: Re: delete the entry from loginwindow.plist using command
  • Next by thread: Re: delete the entry from loginwindow.plist using command
  • Index(es):
    • Date
    • Thread