Programmatically changing Dock preferences

Hi,
Using OS X 10.6.8, I am trying to programmatically change Dock settings to enforce some security guidelines at our company.
Everything is done through a perl script, and works absolutely flawlessly when I run it locally on the computer I want to change, logged on as myself.
Here is a basic snippet of what I've got:
#!/usr/bin/perl
$user = "bob";
$file = "/Users/$user/Library/Preferences/com.apple.dock";
# Force Top-Right hot corner to "Start Screen Saver"
`defaults write $file wvous-tr-corner -integer 5`;
`defaults write $file wvous-tr-modifier -integer 0`;
`killall Dock`;
However, when the change is executed from our policy server, it is doing something odd...The change is made to the dock plist file, however the Dock is reset to the system default settings. It looks like this only happens if the script actually makes a change. (i.e., if wvous-tr-corner was already set to 5, that would blow away the dock preferences) If we do not kill the Dock, the changes do not take effect, so we need a way to kill the Dock without it reverting back to the system default settings.
We can also duplicate this by issuing the "defaults write"  and "killall" commands via Terminal. Note the "sudo"... When this script gets evoked from the policy server, it is called with a sudo, so we included it in our testing on the Terminal.
For example:
1.) Remove an icon or two from the Dock
2.) "sudo defaults write /Users/bob/Library/Preferences/com.apple.dock wvous-tr-corner -integer 5"
3.) "killall Dock"
4.) Once the Dock restarts, the icons removed in Step 1 reappear
Anybody know what is going on here? Is there any way to restart the Dock so that ~our~ changes take effect immediately, but the Dock doesn't revert back to the System default?
Thanks!

Problem Solved.
When we were running the script, it was being executed as root, which means the "defaults write" commands were also being executed as root. This ended up changing ownership of the file from the user who was supposed to be the owner to root, such that when the "killall Dock" statement was issued, it could not read the plist file, and freaked out and replaced it with the system default.
After we are done with all "defaults write" statements, and immediately prior to issuing the "killall Dock" statement, we added the following:
`chmod 0600 $file.plist`;
`chown bob:bobsgroup $file.plist`;

Similar Messages

  • Programmatically changing user preferences when creating an InfoView user in code

    Post Author: rickp101
    CA Forum: .NET
    I am very new to BO (using Business Objects 11.5) so bear with me if I am not clear or seem to have no idea what I'm talking about.
    As a .NET Developer I have been asked to work on a project that involves creating new BO users and logging them in from an ASP.NET application (in order to mimic a single sign in system from another piece of software). I have found most of the information I require for this in the .NET SDK. However there is one function the client would like that I have not been able to find a solution for, and that is to change the users document viewing preferences.
    Within InfoView, if you go into user preferences, under the General tab there is the following option:
    For each document, show me ...
    descriptionownerdateinstance countactions and description (if selected) initially not hidden
    I think by default all of the boxes are checked however the client only wants the description showing for each user when they are set up. Is this something that can be modified within the code when the user is created or is each user going to have to change this themselves manually once logged in?
    Any help will be much appreciated.
    Richard

    Post Author: Ted Ueda
    CA Forum: .NET
    The InfoView settings aren't documented, unfortunately, but with sufficient trial-and-error, you'd be able to determine the correct values.
    The settings are stored in the SI_DATA property 'desktopsettings' for a User object - you can have a look by logging onto 'Query Builder', accessible from the admin launchpad, and entering a query of the form: "Select SI_ID, SI_NAME, SI_DATA From CI_SYSTEMOBJECTS Where SI_KIND='User' And SI_NAME='<username here>'".
    You'd see that, if you've specified the properties manually in InfoView (the property is not there by default) that it consists of '&'-separated key=value entries. 
    You'd retrieve the value via Enterprise .NET SDK call User.GetProfileString("desktopsettings"), and set new values via User.SetProfileString("desktopsettings", <new string value here>). 
    The specific values you're interested in are booleans dv0=1, dv1=1, dv2=1, dv3=1, and dv4=1.
    Sincerely,
    Ted Ueda

  • Dock preferences and behaviors changed since 10.6.3 update

    I just updated and have a strange behavior in my Dock. Previously I set dock to auto-hide, but since the 10.6.3 update the dock behavior has changed. The dock is now fixed at the bottom of the screen and I can't change any of the dock settings in preferences. The dock preference page will display but all the check boxes and drop downs are greyed out by the OS.
    Anyone have any idea where to start? My thought is to delete the plist for dock and allow it to rebuild to default. Does anyone have an alternative suggestion? Thanks.

    Pete,
    Welcome to Apple Discussions.
    ...My thought is to delete the plist for dock and allow it to rebuild to default.
    That would be the first thing to try.
    While you are at it, you may also want to repair disk permissions.
    If neither of those steps work and you used Software Update to install 10.6.3, try downloading and installing the Mac OS X v10.6.3 Update (Combo).
    ;~)

  • Cannot change dock size after Yosemite upgrade

    Ever since upgrading to Yosemite, my dock is large and seemingly fixed in size at the bottom of my screen.  I used to be able to enter System Preferences and change the dock size with the slider.  When I do the same thing now, the slider moves but the dock remains frozen at the same large size.  The dock seems to function perfectly well in every other way.  Help??

    Hi rde45,
    I apologize, I'm a bit unclear on the exact nature or scope of the issue you are describing. If you make changes to other settings in the Dock preferences, such as hiding, magnification, position, etc, do these changes take effect, or are they similar to the dock size setting?
    OS X Yosemite: Dock preferences
    Regards,
    - Brenden

  • Why is 'Dock Preferences' not opening? (Snow L)

    Hi, without any reason I tried to open Dock Preferences to change my Screen Saver and it is just not responding.  I am on Snow Leopard - 10.6.8  I have tried Repair Disk etc but to no avail. It just won't come out to play!!!!  Advice please!

    I am replying to my own post here......I went back in the galaxy of Time Machine, found the last time I had System Preferences in and clicked Restore and Bingo!
    I am still mystified as to why it disappeared when I had not even looked at it for a couple of weeks, mmmmmm!

  • Size slider in the dock preference is "greyed out"

    Hi Folks
    the size slider in the dock preference is "greyed out" and cannot be move -- slide left or right.
    any clue what going on?
    tried resolution changes etc. but the slider wont move.
    thanks in advance

    HI,
    Do you mean the dividing line (spacer) between your Applications and the Trash?
    Carolyn

  • How to find & change stoke preference

    How to find and change stoke preference = null by default for active document,  when doing manual no documents open.
    Thanks
    Simon

    Tom Wolsky wrote:
    You can't change the timebase of a project once there is video in it. Make a new custom project at the right frame rate and copy from the old project and paste into the new one.
    Ok noted with thanks, Tom

  • HT5275 When I download an attachment, it doesn't open in a new window.  It goes to my finder, but I must click on an email attachment at least 3 times in order to find it there.  Is there a way to change the preferences to simply open attachment in a new

    When I download an attachment, it doesn't open in a new window.  It goes to my finder, but I must click on an email attachment at least 3 times in order to find it there.  Is there a way to change the preferences to simply open attachment in a new window?

    http://www.apple.com/feedback/kaywerty wrote:
    A rather long winded way of asking if anybody knows if it's possible to have multi-windows open
    It's not possible.
    Suggestions here -> Apple Product feedback

  • Photoshop CS6 keeps crashing. I am using a brand new IMAC, I have 16GB RAM recently updated as it was running slow with 8GB and lots of hardrive space. When it crashes, i lose all my presents and it changes my preferences, it also fails to save or produce

    Photoshop CS6 keeps crashing. I am using a brand new IMAC, I have 16GB RAM recently updated as it was running slow with 8GB and lots of hardrive space. When it crashes, i lose all my presents and it changes my preferences, it also fails to save or produce a recovered file despite settings asking it to do so every 5 mins now. When i try to report the problem, it says it has found an issue and gives me a link to a solution....but wont let me click on the link.... PLEASE HELP! It's killing my productivity.

    If the crash started right after you added RAM, it could be a bad Ram dimm. You can try this - change the amount of RAM in Photoshop to 4G, this should stop Photoshop from using the higher ram. If it doesn't crash, it's probably the ram. Or run a diagnostic app. You don't say when it crashes, what you're doing when it crashes - it there a pattern? Did it ever work on this computer? Did it work on your previous computer? Without a lot of data, it could be related to the new computer... What OS version? Did you recently update it? Have you updated Photoshop to the most recent update?
    Do you have any plug-ins loaded? Try restarting Photoshop, and immediately press & hold the shfit key to turn off plug-ins.

  • Thunderbird puts a new message at the end of the thread. Is there any way of changing this preference to listing new message at top of the thread?

    Thunderbird puts a new message at the end of the thread.
    Is there any way of changing this preference so that new messages are displayed at the top of the thread.
    This is is more logical. You need to see new message in thread directly, rather than scanning to end of thread to see what is there.

    No it is not possible. The newest message is attached to the message it is in reply to.
    The conversations add-on might better suit your needs. see https://addons.mozilla.org/thunderbird/addon/gmail-conversation-view/?src=ss

  • Since purchasing my Mac Pro with retina display, I can no longer change the preferences on MP Navigator for Canon MX870. Help?

    Since purchasing my Mac Pro with retina display, I can no longer change the preferences on MP Navigator for Canon MX870. I can change them on my old Mac Pro with Lion, but not the new one. I can scan but I can't save it to a folder on my hard drive. I can only let it default to a back up date folder. Tried all sorts of things to change the preferences and folders, nothing worked. Ideas?
    Stephanie

    To prevent your iPhone from automatically syncing when you plug it in, click on iTunes in the menu bar, then preferences, then "devices", then tick "prevent iPhones, iPad's and iPod's from syncing automatically".
    Plug it in, then on the iPhone sync summary screen, click "info" along the top.
    Make sure the "sync contacts" option is not ticked. as long as it's not ticked, then it won't sync with your mac's contacts but will still include them in backups.
    Also, if you use iCloud, make sure that the iPhone/mac are either not signed into the same account, or that "contacts" is not turned on for both of them

  • How do I change print preferences to print in black/white by default instead of color

    how do I change print preferences to print in black/white by default instead of color

    When you try to print, use COMMAND P, it should bring up a window similar to this you can select the preset there. It shoud remember the preset after.

  • VA01 ATP incorrecct results when delivery date is programmatically changed

    Hi Guru's,
    When creating or modifying a sales order (VA01 & VA02), we need to programmatically assign the delivery date a) for certain customers or b) when the delivery priority is changed from downs to regular order and visa-versa. For examples: 1) user enters a delivery date 02/01/2012, the program (userexit_check_vbep) will automatically replace it with a calculated
    date (i.e.. 2/20/2012). 2) if user changes the delivery priority from regular order to a downs order, the program will automatically replace delivery date to current date.
    But are getting incorrect ATP results when requested delivery date (based on what user enters in VBAP-LPRIO "delivery priority") is programmatically changed and then user manually enters the date and run ATP (see steps 8 & 9 below).  
    VA01 execution steps:
    1) Used VA01 and entered a material of quantity 1, requested date 2/01/2012, delivery priority = regular. Date was overwritten automatically with program calculated date 2/20/2012 as expected.
    2) ATP automatically ran successfully for the initial entry.
    3) I then changed the delivery priority from regular order to downs order & requested delivery date was automatically changed to current date 02/01/2012 as expected.
    4) ran ATP manually and all is well.
    5) I then changed the delivery priority back to a regular order and date was automatically changed back to 02/20/2012 as expected.
    6) I ran ATP manually and again all is well.
    7) I then manually changed the delivery date 02/25/2012.
    Incorrect / bad results:
    8) ATP then passed back 2 sub-items lines with the quantity of 1 each. The quantity on the main line item is doubled to 2.
    9) I then tried to delete the main line item manually to start all over, but the transaction just hangs because it tries to go to ATP, but cannot resolve what to delete.
    Do you have any suggestions to help resolve this?   
    The following SAP user-exits were modified:
    a) MV45AFZB
      1) userexit_check_vbap
      - for certain customers (a custom "override days" field stored in VBAP is populated), delivery date is automatically calculated using this field (i.e.  current date + override days).   If user entered date < calculated date,   calculated date is used (xvbep-edatu).
      - If user changes delivery priority, xvbep-edatu will be set automatically to either the calculated date (regular order) or current date (downs order).
      2) userexit_check_vbep : if user enters a delivery date (vbep-edatu), it is checked against calculated delivery date & overwritten, if it is < calculated date.
    b) MV45AFZZ - userexit_move_field_to_vbap :
      - override days is determined & delivery date is automatically calculated. If user entered date < calculated date, calculated date is used (xvbep-edatu).
      - If user changes delivery priority, xvbep-edatu will be set automatically to either the calculated date (reg.order) or current date (downs order)
    Reason for updating xvbep: if only vbap-lprio or vbap-override (custom field) fields are changed, the VBEP user exit routines (userexit_move_field_to vbep or userexit_check_vbep)  do not run.  Change to xvbep does trigger userexit_check_vbep.
    Please advise.
    Joe

    This is not an SD question and should be moved to ABAP forum. It seems to me that the issue is not with incorrect ATP but with the subitems / main item updated incorrectly. This needs to be resolved by a developer who wrote the user exit. Most likely either a user exit is triggered when not expected or a wrong line updated, etc. Debugger should be helpful.
    Also instead of setting delivery priority, why can't the users just change the delivery date to current date? This seems just as easy to me...

  • How to programmatically change the cell color of an ADF table ?

    Hi all,
    I have an ADF table with some fields on it. Depending on the value of a field named, say, "F1", I would like to change its background color.
    So far I can change the field color with this EL expression inside the InlineStyle table column property:
    font-size:medium; background-color:#{viewScope.myBean.setColor};
    where setColor is a bean function, in where I access the field "F1" via binding, parse its value, and return the right value - so far, so good.
    The bad thing is, the InlineStyle affects that field in all the rows of the table, while I would like to change only the field in the rows, which have that specific value in it.
    So for example having the rows:
    F1
    abc#1 ----> currently selected row
    cde#2
    efg#3
    I want to change the background color to all the F1 fields which have a "1" after the '#' and let the other "F1" row cells background color stay unchanged.
    But as you can imagine, the InlineStyle affect the "F1" background color in all the rows (assuming that the first row of the table is selected).
    So the question: how to access a single cell of a row in an ADF table, and programmatically change its background color ?
    So far I can iterate through the ADF table with:
    BindingContext bindingctx = BindingContext.getCurrent();
    BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
    DCBindingContainer bindingsImpl = (DCBindingContainer) bindings;
    DCIteratorBinding dciter = bindingsImpl.findIteratorBinding("aTableIterator");//access the iterator by its ID value in the PageDef file
    RowSetIterator rsi = dciter.getRowSetIterator();
    System.out.println("rsi getrowcount = " rsi.getRowCount());+
    Row row = null;
    +if (rsi.getRowCount() > 0) {+
    row = rsi.getCurrentRow();
    System.out.println("row attr = " Arrays.toString(row.getAttributeNames()));+
    System.out.println("class : " row.getAttribute("F1").getClass().toString());+
    +}+
    +while (rsi.hasNext()) {+
    row = rsi.next();
    System.out.println("row attr = " Arrays.toString(row.getAttributeNames()));+
    +}+
    Regards,
    Sergio.

    Hi,
    I mean a specific cell within a row.
    Here are two pictures that show an ADF table with two rows and some fields on it:
    https://skydrive.live.com/?cid=7D3084D8BF755808&id=7D3084D8BF755808!107&sc=documents#cid=7D3084D8BF755808&id=7D3084D8BF755808!107&sc=documents
    bild_A is what I have, bild_B is what I would like. Note that:
    in bild_A the first row contain a yellow background color for the field F4 and an orange background color for the field F5. This is correct, because F4 has an "1" at the end of its string value, and F5 has a "3" at the end. So far so good.
    But the second row (again, bild_A) has also the fields F4 with yellow background color, and the field F5 with orange background color, even if the value in both fields is 0.
    What is should be, is shown in bild_B.
    The problem is that the solution provided affects all the cells of the column, while I need to change the background color of a single cell, and leave the other unchanged (see bild_B).
    I hope that clarify a bit :)
    Sergio.

  • Can I Programmatically Change the Active Group on a Hypertrend in DSC?

    I would like to know how to programmatically change the active group of a hypertrend in Labview DSC.  I saw a link which said it can be done in Lookout.  But in the DSC module, the active group is read only.
    I know of a hard way to do it.  I could save the hypertrend settings as xmlSettings to a temporary file.  The active group is one of the settings.  I could then change the active group in this text file to point to the new group and then reload the settings.  But this is not a clean way of dong it.
    Anyone know if there is a easy way?
    Solved!
    Go to Solution.

    I found a way to do it but its not very clean.  I dont know why there is not a function to change the current group.
    Here is how I did it.

Maybe you are looking for