Hi Pierre,
Sorry to be pestering you again – I realised later that my MacBook Pro defaults to using a slash as a delimiter in the short date field for both the UK and German locales. I had changed this manually to full stops but now I'm changing region using the AppleScript, the delimiter defaults back to the slash, i.e. 03/06/2015 whereas I want 03.06.2015.
I've tried solving this myself by adding the following code to your script:
set settings1 to {"Europe", "Germany"}
set settings2 to {"Europe", "United Kingdom"}
tell application "System Preferences"
activate
set current pane to pane id "com.apple.Localization"
end tell
tell application "System Events"
tell process "System Preferences"
tell window "Language & Region"
if (value of pop up button "Region:" of group 1) is in settings1 then
set {theRegion, theCountry} to settings2
else
set {theRegion, theCountry} to settings1
end if
tell pop up button "Region:" of group 1
delay 0.25
click
clickmenu itemtheRegion of menu 1
clickmenu itemtheCountry of menu 1 of menu itemtheRegion of menu 1
end tell
if theCountry is in settings2 then
click button "Advanced…"
delay 0.25
tell tab group 1 of sheet 1
click pop up button "Currency:"
keystroke "Euro" & return & return
delay 0.25
end tell
end if
click button "Advanced…"
delay 0.25
tell tab group 1 of sheet 1
clickradio button "dates"
delay 0.25
keystroketab
keystroke "a" usingcommand down
set the clipboard to "dd.MM.y"
keystroke "v" usingcommand down
delay 0.25
keystrokereturn
keystroke "w" using {command down}
end tell
end tell
end tell
end tell
This seems to work more or less except that I've obviously messed up the If / then sequence. The script seems to work the way I want, but only some of the time! Can you put me right?
Thanks in advance (again),
Steve