Applescript Question---- Add to login items

Discussion in 'Mac Programming' started by jjordanlam, Jan 22, 2011.

  1. jjordanlam macrumors newbie

    Jan 22, 2011
    Hello, first of all let me say that I work for a computer security company, and I train our "Virus Fighters."As part of their training I need to make an applescript application that when opened, will first add itself to the user's login items, then shutdown the computer. The aim of this is that whenever the Fighter logs on to their account, the computer turns off. I am planning on doing this when the Fighters leave the office for the night, so that they will wake up to a nice morning challenge. I already have the shutdown command, but I was wondering how to add to some sort of login items when the application runs. Thanks for your help!

    P.S. I have already googled it.
  2. ulbador macrumors 68000


    Feb 11, 2010
    I think you basically answered your own question.

    Create the AppleScript application and save it as an application. Open up the System Preferences, click Accounts, and add the application you created to the user's login items. Or maybe I'm not reading what you want to accomplish correctly, but this all seems very straight forward with just a handful of clicks.
  3. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    And what did you find? How did it not answer your question?

    When I google it, I find a decent number of results that show exactly how to do what you ask for. If those aren't what you're looking for, please explain why not.

    Google search terms I used:
    applescript add login item
  4. jjordanlam thread starter macrumors newbie

    Jan 22, 2011
    I am looking for a script that will add istelf to login items automatically, because that's what a client will most likely do. A client will not set up its own virus, because then they could just delete it from login items once they realize what they did. I need something that will do it all once I run the script.
  5. ulbador macrumors 68000


    Feb 11, 2010
    Even though I initially misunderstood what you were trying to do, this google search got me exactly to what you are attempting.... One of the first few links even outlines how to check to see if the item already exists and add it if it doesn't. I highly assume that running this as described would also cause a password popup to occur, so it wouldn't be entirely automagic.

Share This Page