tell current application
do shell script "defaults read com.apple.dock orientation"
"2007-01-12 10:42:38.293 defaults[514]
The domain/default pair of (com.apple.dock, orientation) does not
exist"
If you change the orientation of the Dock from the default, there
WILL exist an 'orientation' key in the com.apple.dock.plist
preference file. It will have a value of 'left', 'middle' or 'right'.
You can create this key by reading, modifying, then writing the
contents of the preference file.
I have a script that restores my preferred orientation, size and
anchor for the Dock. These preferred values are written to the record
newRecord = {|orientation|:orien, pinning:pin, tilesize:iconSize}
then ...
set prefsFile to (path to preferences from user domain) as text
bundle identifier of (info for (path to application "Dock"))
tell application "Finder" to set prefsFile to (prefsFile & the
result & ".plist") as alias
tell application "System Events"
set dockPath to (POSIX path of prefsFile)
value of property list file dockPath -- read
set dockRec to newRecord & the result -- modify
set (value of property list file dockPath) to dockRec -- write
end tell
tell application "Dock" to quit
(The order of concatenation must be as shown in the modify line.)