Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

satyam90

macrumors regular
Original poster
Jul 30, 2007
242
0
Bangalore, India
Hi,

I am using XCode 2.4.1 on Mac Tiger.

I have an application which I want to start it at the time of logging into Mac :apple:. I want to do it programatically by providing an option in my application like "Start application when logging". I don't want to set it from dock.

Also I have user authentication in my application. In that if I want to provide an option to remember password, where can i store it. In windows I am storing in registry by encrypting it. In Mac how to achieve this.

Please help me.

Regards,
Satyam.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
I am using XCode 2.4.1 on Mac Tiger.

That is like saying, "I am using Visual Studio 2005". Doesn't really help. The API could be Carbon or Cocoa or AppleScript Studio or plain old standard C libraries. You need to post what language/API you're using.

Either way, check out this page. The link for LoginItemsAE will work with Carbon or Cocoa.

Also I have user authentication in my application. In that if I want to provide an option to remember password, where can i store it. In windows I am storing in registry by encrypting it. In Mac how to achieve this.

Doesn't really matter, but easiest method would be to use the same method of encryption you used in the Windows app and save it to the standard preferences using NSUserDefaults (Cocoa) or CFPreferences (Carbon).
 

satyam90

macrumors regular
Original poster
Jul 30, 2007
242
0
Bangalore, India
sorry for not mentioning the environment in which i am working.

I am working on Cocoa with Obj C.
In the example LoginItemsAE, it is writted purely in C. how can i use that in my project and add the option to my application "start the application when logging in".
 

satyam90

macrumors regular
Original poster
Jul 30, 2007
242
0
Bangalore, India
i couldn't understand how to use the example LoginItemsAE.
instead, we can use following code like this:


CFArrayRef prefCFArrayRef = CFPreferencesCopyAppValue(CFSTR("AutoLaunchedApplicationDictionary"), CFSTR("applicationID"));
CFMutableArrayRef tCFMutableArrayRef = CFArrayCreateMutableCopy(NULL, 0, prefCFArrayRef);
/* Modify tCFMutableArrayRef here */
CFPreferencesSetAppValue(CFSTR("AutoLaunchedApplicationDictionary"), tCFMutableArrayRef, CFSTR("applicationID"));

In the above code, how to know the "applicationID" ...........
 

satyam90

macrumors regular
Original poster
Jul 30, 2007
242
0
Bangalore, India
Hi, great solution.

I tried to use the files specified in "UKLoginItemRegistry".
But I am getting following errors:

Couldn't list login items error 1700
Couldn't add login item error 1700
Couldn't remove login in item error 1700

How to solve this ???
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.