Re: screen size available (without dock)
Re: screen size available (without dock)
- Subject: Re: screen size available (without dock)
- From: John Baltutis <email@hidden>
- Date: Thu, 20 Mar 2014 15:23:17 -0700
On 3/20/14, "koenig.yvan" <email@hidden> wrote:
>
> I found this piece of code :
>
> tell application "Safari"
> -- Determine space open on your screen, factoring in the Dock
> set screenWidth to do JavaScript "screen.availWidth" in document 1
> set screenHeight to do JavaScript "screen.availHeight" in document 1
> end tell
>
> It works well but I wish to know if we may get the same infos without
>JavaScript.
>
> I was hoping to get useful datas thru :
>
> tell application "System Events" to tell dock preferences
> dock size
> --> 0.045454546809
> end tell
>
> and I don't know how to convert this decimal value in points.
> According to what is returned by JavaScript the width of the Dock is 39
>points.
AFAICT, dock size isn't a good value; whereas, tilesize from the Dock's plist
file is about 2/3 the Dock's height in terms of screen resolution. If so, then
this should give you what you want. You can modify the 1.5 value until you
ascertain the exact Dock height. My 27" display's resoluton is 2560 x 1440.
tellapplication "Finder"
set _b to bounds of window of desktop
set _width to item 3 of _b
set _height to item 4 of _b
end tell
set a to do shell script"defaults read com.apple.dock |grep tilesize"
set dockheight to 1.5 * (item 3 of words of a) as integer
set _availHeight to _height - dockheight as integer
display dialog "availWidth = " & _width & return & "availHeight = "&
_availHeight
--> availWidth = 2560and availHeight = 1396.
_______________________________________________
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/archives/applescript-users
This email sent to email@hidden