Problem With Global Login Items

Discussion in 'Mac Programming' started by MitchBall, Sep 15, 2014.

  1. MitchBall macrumors newbie

    Sep 15, 2014
    I have searched everywhere for how to set up login items and ran different scripts in terminal, applescript, and xcode.

    However none have seemed to work, what needs to be done is a global login item needs to run a .app file which maps 2 network drives, and another .app which runs printer software, however none of the scripts i have used have worked.

    If anyone could provide a link, or code, or any help or how to, it would be highly appreciated.

  2. kryten2 macrumors 6502a

    Mar 17, 2012
    Please provide some links, or code from the things you tried that didn't work.
  3. MitchBall, Sep 15, 2014
    Last edited by a moderator: Sep 15, 2014

    MitchBall thread starter macrumors newbie

    Sep 15, 2014

    Also; I have tried codes such as -

    -(void) addAppAsLoginItem{
    	NSString * appPath = [[NSBundle mainBundle] bundlePath];
    	// This will retrieve the path for the application
    	// For example, /Applications/
    	CFURLRef url = (CFURLRef)[NSURL fileURLWithPath:appPath]; 
    	// Create a reference to the shared file list.
            // We are adding it to the current user only.
            // If we want to add it all users, use
            // kLSSharedFileListGlobalLoginItems instead of 
    	LSSharedFileListRef loginItems = LSSharedFileListCreate(NULL,
                                                         kLSSharedFileListSessionLoginItems, NULL);
    	if (loginItems) {
    		//Insert an item to the list.
    		LSSharedFileListItemRef item = LSSharedFileListInsertItemURL(loginItems,
                                                         kLSSharedFileListItemLast, NULL, NULL,
                                                         url, NULL, NULL);
    		if (item){

    Nothing Still seems to work, we are trying to run this in a school for users to log on and have all drives ready for use, we are running OS X 10.9.4.

    Thanks in advance.

Share This Page