I have a new MacPro desktop with a 20" ViewSonic Optiquest widescreen monitor. Every time the computer restarts, it resets the display settings and has to manually be reset back to 1680 x 1050. I’ve tried all the tips and tricks I could find to get it to stop doing that (deleting preferences and zapping PRAM, etc) and none of them worked. So now I’m thinking I could work around it by creating an Applescript that will reset the display resolution at startup.
Here’s what I’ve written so far. It opens the Displays preference pane, but I can’t get it to select the resolutions value from the menu. I get the error “NSReceiverEvaluationScriptEditor: 4”:
tell application “System Preferences”
reveal anchor “displaysDisplayTab” of pane id “com.apple.preference.displays”
end tell
tell application “System Events”
tell process “System Preferences”
tell menu 1
click menu item “1680 x 1050” of menu bar item “AXValue (W)” of window “AL2223W”
end tell
end tell
end tell
quit application “System Preferences”
“AL2223W” is the name of the window the Display preferences shows when it’s open. I used UI Element Inspector to get the following info on that preference pane, which is where I got “AXValue (W)” from as the name for the menu that lists the available resolutions:
Attributes:
AXRole: “AXTextField”
AXRoleDescription: “text field”
AXHelp: “(null)”
AXValue (W): “1680 x 1050”
AXEnabled: “1”
AXFocused: “0”
AXParent: “”
AXWindow: “<AXWindow: “AL2223W”>”
AXTopLevelUIElement: “<AXWindow: “AL2223W”>”
AXPosition: “x=974 y=616”
AXSize: “w=179 h=17”
AXChildren: “<array of size 0>”
AXSelectedText: “(null)”
AXSelectedTextRange: “(null)”
AXNumberOfCharacters: “11”
AXVisibleCharacterRange: “pos=0 len=11”
AXInsertionPointLineNumber: “(null)”
Actions:
AXShowMenu - show menu
AXConfirm - confirm
Any suggestions?