Add/remove script in "Login items" in "System preferences" - "Users,Group"

Discussion in 'Mac Programming' started by hatbe, Nov 5, 2011.

  1. hatbe macrumors newbie

    Joined:
    May 12, 2011
    #1
    Hi,

    I'd like to add and remove my own test scripts/apps in the "Login Items" from the "System preferences" / "User. Group" by using the terminal command line (not from the GUI).]

    I am running Mac OSX Lion 10.7.1 and 10.7.2

    For exp:

    - add scripts from /Users/myuser/myscript1.sh to the "Login Items"
    - remove script myscript2.sh from the "Login Items"
    - and so on...

    Does the defaults command or something else can do these actions, if so what is the syntax? I would appreciated any helps.

    Thanks,
    HB
     
  2. Partron22, Nov 5, 2011
    Last edited: Nov 7, 2011

    Partron22 macrumors 68000

    Partron22

    Joined:
    Apr 13, 2011
    Location:
    Yes
    #2
    Have a look at your User Library: /Preferences/com.apple.loginitems.plist

    You'll see your login items there.

    Objective C or Applescript are better suited to modifying plists than is Shell.

    Either of those languages will provide a decent front end for parsing terminal's
    Code:
    defaults read com.apple.loginitems
    and the corresponding write commands.
     

Share This Page