Re: Dock position and size
Re: Dock position and size
- Subject: Re: Dock position and size
- From: Bill Cheeseman <email@hidden>
- Date: Fri, 12 Jan 2007 04:39:35 -0500
- Thread-topic: Dock position and size
on 2007-01-12 2:54 AM, Per Sjöstrand at email@hidden wrote:
> Is there a way to get the position and the size
> of the Dock through an AppleScript?
Using GUI Scripting, this script will get the position of the dock:
activate application "Dock"
tell application "System Events"
tell process "Dock"
get position of list 1
end tell
end tell
--> {12, 1014} on my system
The dock does not have a 'window' attribute. To get the size of the dock on
the screen, you would have to get its position as above, and tell the Finder
to get the size of the main screen, and do some arithmetic based on the
assumption that the dock is centered on the main screen.
Telling the Finder to get the size of the main screen can be a little tricky
if you have multiple monitors. On a one-monitor system, the main screen is
'scroll area 1 of application "Finder"' and you can use GUI scripting to get
its size attribute. On my system, a second monitor is located to the left of
the main monitor holding the dock. I can get the 'size' attribute of 'scroll
area 1 of application "Finder" and it yields the size of the two monitors
combined, {2960, 1050}, and I can get the 'position' attribute, {-1280,0}.
Using the knowledge that my main monitor is on the right and my dock is on
the bottom of the main monitor, I can figure out the dock's size as
described above.
However, if I move the dock to the left instead of the bottom, it moves to
the secondary monitor. I assume the dock moves to the secondary monitor if
you position your monitors vertically, too, or with the main monitor on th
left and the dock on the right, but I haven't tried that.
I haven't thought of a general solution to determine the relative positions
of multiple monitors using AppleScript.
--
PLEASE NOTE MY NEW E-MAIL ADDRESS:
Bill Cheeseman - email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden