Re: delete the entry from loginwindow.plist using command
site_archiver@lists.apple.com Delivered-To: macnetworkprog@lists.apple.com Am 29.01.2008 um 21:07 schrieb "sunil prajapati" <skumar2011@gmail.com>: Hi Guys, Does this have anything to do with the topic of this mailing list? loginwindow.plist,but it remove whole entries from the plist. The command is: See: <http://developer.apple.com/technotes/tn2005/tn2083.html> -- Thanks & Regards, 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. _______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (Macnetworkprog@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/macnetworkprog/site_archiver%40lists.... I successfully entered my application in loginwindow.plist through command line. But unable to delete that entry. 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
#!/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. Sunil Prajapati Software Developer in Macintosh
participants (1)
-
Mike Fischer