Re: Login item support for Panther, Tiger and Leopard
Re: Login item support for Panther, Tiger and Leopard
- Subject: Re: Login item support for Panther, Tiger and Leopard
- From: "Devraj Mukherjee" <email@hidden>
- Date: Tue, 12 Feb 2008 16:27:02 +1100
This may not be an elegant solution but I had the same issue and
finally ended up resolving it using AppleScript
/* Adds/removes binary as a login item */
- (IBAction) addRemoveLoginItem: (id) sender
{
AXTAppleScriptRunner * scriptRunner = [[[AXTAppleScriptRunner alloc]
init] autorelease];
if([[isLoginItem stringValue] isEqualToString: @"1"])
{
NSLog(@"Will try and use an AppleScript to make this a login item");
NSString * addToLoginItemScript = @"\
set app_path to path to me\n\
tell application \"System Events\"\n\
if \"AddLoginItem\" is not in (name of every login item) then\n\
make login item at end with properties {hidden:false,
path:app_path}\n\
end if\n\
end tell";
[scriptRunner runScriptWithString: addToLoginItemScript];
}
else
{
NSLog(@"Will try and use AppleScript to unload this as a login item");
}
}
On Jan 31, 2008 8:41 PM, Apparao Mulpuri <email@hidden> wrote:
> Hi,
>
> I have an application which will run on Panther, Tiger and Leopard
> versions.
>
> Now, i want to launch my application automatically after user(should work
> for all users in the installed machine) logs in. I have tried with the
> Startup item, LaunchAgents and login item concepts.
>
> First, i have tried with Startup items, because above three versions
> supports this feature. But the problem is, my application starts before the
> Login window. I have tried with the Requires and Uses keys available in
> Startupitems.plist, but no result.
>
> Second, i have tried with the LaunchAgents. Its working as expected in
> Tiger and Leopard, but not in Panther. Is any one knows, how to do in
> Panther?.
>
> Third, i have to update the loginwindow.plist file using Cocoa/Carbon
> application. But, this is not the solution, which i am looking for. I have
> to acheive this functionality at the time of Installation i.e using
> Installer scripts.
>
> - Apparao.
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
--
"I never look back darling, it distracts from the now", Edna Mode (The
Incredibles)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden