Re: delete the entry from loginwindow.plist using command
site_archiver@lists.apple.com Delivered-To: macnetworkprog@lists.apple.com Am 30.01.2008 um 11:37 schrieb sunil prajapati: Thanks Mike for your help. And your question is?
From Apple's technote on Daemons and Agents:
Mike Thanks, Sunil. On Jan 30, 2008 10:46 AM, Mike Fischer <mike_fischer@mac.com> wrote: 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. -- 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 (Macnetworkprog@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/macnetworkprog/site_archiver%40lists.... The link which have given there is one sample code "LoginItemsAE" which is used to add and delete the entry from ~/Library/ Preferences/loginwindow.plist. I want the same kind of functionality which will be used for all the users i.e. plist which will be common for every user. My application is GUI based and I want to launch it after login so I can use "lauchd" . In the link of technote there is detail information for "Global Login Item". It is mentioned as: A global login item is a login item that is launched when any user logs in. Installing a global login item is roughly equivalent to installing that login item for all users on the system: every time a user logs in, loginwindow launches that user's login items and all global login items. In Mac OS X 10.5 and later you can install a global login item using the shared file lists interface to Launch Services. How we can go for global login item? I give up! I suggested multiple times that you need to read the technote. Obviously you at least looked at it (after ignoring the suggestion at first) but you didn't really read all of it. If you had you would not have to ask this question again. I again strongly suggest reading the technote and in addition to also read: <http://catb.org/~esr/faqs/smart-questions.html> Please do not contact me privately again. If you have questions ask them on the appropriate mailing list.
On Jan 30, 2008 2:31 AM, Mike Fischer <mike_fischer@mac.com> wrote:
Am 29.01.2008 um 21:07 schrieb "sunil prajapati"
<skumar2011@gmail.com>:
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
participants (1)
-
Mike Fischer