The best way to deal with Dictionary MCX

CypherCookie
Contributor

Aim : to get an application to automatically open upon login for users.

Problem : I've been trying to figure out the best way to try and get an application to start at login for users. What i've found is that its impossible to do in Casper unless you have machines being controlled by work group manager.

This is due to the fact that under the users preferences the login items are added as a dict entry. It would be possible to This is not an issue if you are creating these files for new users but they are for existing users who have already modified their login items.

Solution : The only way around this that i found was to write a simple script to create my own personal folder within their library, from that i can then write a file which i use as a flag to turn on or off the automatic open command for the application.

I use the simple "open" command to open the application every time and then exempt users by removing the file created in the directory i created.

You can use this method to set loads of different flags for different things.

2 ACCEPTED SOLUTIONS

bentoms
Release Candidate Programs Tester

davidacland
Honored Contributor II

You can add the item into their login items:

osascript -e 'tell application "System Events" to make login item at end with properties {path:"/path/to/itemname.app", hidden:true, name:"Customized Name"}'

Create a policy and add this to the "Files and Processes" section under "Execute Command", set to once per user.

View solution in original post

6 REPLIES 6

bentoms
Release Candidate Programs Tester

@CypherCookie, why not a LaunchAgent?

CypherCookie
Contributor

Yes you could do that, however I don't think i have adequate skills to implement that. We are doing a pilot and we want users to have the ability to turn off this function this was my solution.

I also imagine that what we have been told about how they want the application to act will change as well.

davidacland
Honored Contributor II

You can add the item into their login items:

osascript -e 'tell application "System Events" to make login item at end with properties {path:"/path/to/itemname.app", hidden:true, name:"Customized Name"}'

Create a policy and add this to the "Files and Processes" section under "Execute Command", set to once per user.

CypherCookie
Contributor

Hi David,

I did try that and found that it didn't work on my 10.9.5 or 10.10.1 machine. thats why i ended up creating a script instead.

CypherCookie
Contributor

@davidacland just tried your line and it worked a treat! :O

milesleacy
Valued Contributor

Don't mess with success, but here's an alternative method...

The Login Items payload in an OS X Configuration Profile can achieve this as well.