Programmatically select the login item's hide option in Mac
I need to create a cocoa application, that run in back ground. I used lssharedFilelist to write an an application this was successful and the application is added to the login item in my Mac. My problem is to done the hide option check-box automatic selection. Is any method for do the above problem using 开发者_如何学Goany program such as lssharedFilelist, any other. If anybody know please Help Me. Thanks in advance.
You can achieve this using a single line of AppleScript:
osascript -e 'tell application "System Events" to make new login item with properties {path: "/path/to/application", hidden: True} at end'
Set hidden
's value to True/False depending on whether or not you want the checkbox checked/unchecked, respectively.
Not sure of a Cocoa-esque way to do this, sorry.
精彩评论