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