Le 31 mai 07 à 23:46:10, Oakley Masten a écrit : Hi All
OK another simple question. How do I get monitor resolution and screen bounds?
I'm sure it is simple - I just can't find it :)
Thanks Oakley
Here is an old message:
Objet : Rép : dimensions of the visible region of the main monitor Date : 19 mars 2007 21:21:56 HNEC
I'd like to get the dimensions of the visible region of the main monitor. Something like this:
set mainScreen to call method "mainScreen" of class "NSScreen" set [x1, y2, x2, y2] to call method "visibleFrame" of mainScreen
I'd like to do this in a vanilla script, not within AppleStudio. I looked in Standard Additions but didn't see it there.
Your best bet is to get cscreen, available at /usr/local/bin/, and use the command: do shell script "/usr/local/bin/cscreen". The help command for csreen is:
cscreen -h Usage: cscreen [-d <depth>] [-x <width>] [-y <height>] [-r <refresh>] [-s <display>] [-v] [-m] [-f] [-l] [-h] [-d <depth>] : specifies the bit depth (bits per pixel) [-x <width>] : specifies the width in pixels [-y <height>] : specifies the height in pixels [-r <refresh>] : specifies the refresh rate in Hz [-s <display>] : specifies which display to use (defaults to main display) use a as the option to -s to specify the action on all displays [-v] : display valid modes (use -s to specify display or nothing for the default) [-m] : require an exact match [-f] : forcessettings (ignores safety mechanisms; USE AT YOUR OWN RISK) [-l] : lists the current displays and modes [-p] : sets the requested display to be the primary display [-h] : displays the usage
Sample output:
1 display found Index Depth Width Height Refresh(Hz; LCD displays show 0) 1 32 1600 1200 75
Yvan KOENIG |