Problem with shell scripting system preferences

Discussion in 'Mac Programming' started by Magrão, Nov 6, 2014.

  1. Magrão macrumors newbie

    Mar 4, 2011
    I have a particular problem because of a bug in Excel for Mac 2011 in Yosemite. I have discovered a workaround: by changing the Region setting, in SystemPreferences/Language & Region, to a non-GMT locale, the bug no longer occurs. For instance, if I change Region from United Kingdom, to Italy, the bug doesn't occur.

    I've been developing a macro that runs an AppleScript, that in turn runs a shell script, to change the setting using the defaults utility. The shell script I'm using is this:
    defaults write NSGlobalDomain AppleLocale en_GB
    The intention being that on opening Excel, the application changes the value of AppleLocale, the bug is zapped and then, on closing, it changes AppleLocale back to what it as previously.

    Changing the setting of AppleLocale programmatically on opening Excel works fine. But Excel only recognises this change if I then restart it. However, if I make the change using the System Preferences GUI, then I don't need to restart Excel for it to recognise the change.

    I really want to avoid GUI Scripting, so I'm wondering if some clever bod out there might know why this scripted change isn't recognised. Do I need to do something else to force Excel to recognise the change?

    Thanks for any help... :)
  2. balamw Moderator


    Staff Member

    Aug 16, 2005
    New England
    MOD NOTE: You're more likely to find an answer here in the programming section, so I moved your thread.


Share This Page