• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: screen size available (without dock)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Bounds_of_Document_QXP10
  • Next by Date: Re: Bounds_of_Document_QXP10
  • Previous by thread: Re: screen size available (without dock)
  • Next by thread: Bounds_of_Document_QXP10
  • Index(es):
    • Date
    • Thread