I must be having a brain fart because I can’t solve this problem. In 10.5 we now have access to some new “Scriptable System Preferences” as seen here. So I’m trying to find the location of the dock (i.e. bottom, right, or left) using these new capabilities. So I can get the dock preferences like so…
tell application "System Events"
tell dock preferences
set dock_props to get properties
end tell
end tell
But the following doesn’t work so I cannot extract the location from the dock_props. Any thoughts why it doesn’t work or a solution???
tell application "System Events"
tell dock preferences
set dock_props to get properties
set dock_location to location of dock_props
end tell
end tell
this seems to be a bug, same error here
Work around
tell application "System Events"
set dock_props to properties of dock preferences
try
set dock_location to location of dock_props
on error e
set {ASTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "location:"}
set dock_location to word 1 of text item 2 of e
set AppleScript's text item delimiters to ASTID
end try
end tell
dock_location
Just as an FYI…
I was trying to use the new capabilities of applescript in 10.5, but you can still get the dock’s location this way:
tell application "System Events"
set dockProps to property list file "~/Library/Preferences/com.apple.dock.plist"
set dock_location to the value of the property list item "orientation" of dockProps
end tell