I think this is a bug in Mac OS X: with a dual monitor setup, the Dock switches to the 2nd (not main) monitor from time to time.
To fix this issue, I open the Dock, and click both the "Left" and "Bottom" radio buttons for the "Position on Screen" item.
I need to automatizeautomate this with AppleScript. I could open the Dock using this script, but I'm not sure how to click the Left and then Bottom radio button in AppleScript.
tell application "System Preferences"
set the current pane to pane id "com.apple.preference.dock"
activate
end tell
I tried to add some code in the script, but it does not work.
click radiobutton "Left"