Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Tile Safari windows via AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Tile Safari windows via AppleScript
Authored by: lxmorj on Dec 29, '06 02:31:45PM

The location of the dock is stored as the string "left" "right" or "bottom" in ~/Library/Preferences/com.apple.dock.plist. If someone can please let me know how to get the plist stored as a string, it will be very simple to account for left-side docks...



[ Reply to This | # ]
reading preferences with 'defaults'
Authored by: anoved on Dec 29, '06 03:48:25PM
The location of the dock is stored as the string "left" "right" or "bottom" in ~/Library/Preferences/com.apple.dock.plist. If someone can please let me know how to get the plist stored as a string, it will be very simple to account for left-side docks...

Here's one way:

set dockSide to do shell script "defaults read ~/Library/Preferences/com.apple.dock orientation"

Now dockSide should contain the value of the Dock's orientation preference. Note that in this case the defaults program doesn't need the .plist suffix to be specified.

I think you can read and write preference defaults directly in AppleScript Studio (XCode), but do shell script works for regular scripts.



[ Reply to This | # ]
Tile Safari windows via AppleScript
Authored by: Frederico on Dec 29, '06 03:54:20PM

use:

do shell script "defaults read ~/Library/Preferences/com.apple.dock | grep orientation"

Beware, however, that the orientation flag is never (at least under 10.2 and earlier) generated until the user changes the default location of the Dock from 'bottom' at least once. Thus, be sure to error check for a null result of the above code snippet, and assume that null is default (bottom).



[ Reply to This | # ]
Reading property list items with System Events
Authored by: anoved on Dec 30, '06 07:19:17PM

Just for the sake of reference, here is another way to read a property list preference item with plain AppleScript:

tell application "System Events"
	set dockProps to property list file "~/Library/Preferences/com.apple.dock.plist"
	set dockSide to the value of the property list item "orientation" of dockProps
end tell

Again, dockSide should end up with the value of the orientation property. Just an alternative to do shell script.



[ Reply to This | # ]