• 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: get size of available screen fails
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: get size of available screen fails


  • Subject: Re: get size of available screen fails
  • From: Adam Bell <email@hidden>
  • Date: Wed, 4 Jan 2006 20:30:55 -0400

It works, but I found the system_profiler painfully slow, never having figured out that it had the ability to capture a portion like DisplaysData by itself. Neat.

On 1/4/06, Reese, Stevan <email@hidden> wrote:
Here is one for the 'there is always another way' ...
In the shell;
system_profiler SPDisplaysDataType|grep Resolution
returns;
          Resolution: 1280 x 854

When I plug in another monitor the same returns;
          Resolution: 1280 x 854
          Resolution: 1600 x 1200 @ 60 Hz

I have not expanded this to work with more than one monitor;

tell application "Adobe InDesign CS2"
    activate
   set MyScreenResolution to paragraphs of ( do shell script "system_profiler SPDisplaysDataType|grep Resolution|awk -F\\   '{print $2}{print $4}'")
    set horiz to item 1 of MyScreenResolution --Get horizontal pixels
   set vert to item 2 of MyScreenResolution --Get Vertical pixels
   
    set theWindow to active window
   tell theWindow -- Joe modified this tell statement
       set bounds to {72, 4, (vert - 48), (horiz - 4)} -- sets window to fit screen 72 from top allows for tools, 48 from bottom allows for Dock.
       set view display setting to typical
       zoom given fit spread -- fits spread in window
   end tell
end
tell

On 1/4/06 12:45 PM, "Björn Lundin" <email@hidden> wrote:

4 jan 2006 kl. 16.11 skrev Adam Bell:

For one screen, this works:

do shell script "echo `defaults read /Library/Preferences/com.apple.windowserver | grep -wA 1 -m 1 OriginX` `defaults read /Library/Preferences/com.apple.windowserver | grep -w -m 1 Height``defaults read /Library/Preferences/com.apple.windowserver | grep -w -m 1 Width`"

Note that the back slanted single quotes ` are NOT '

returning: "OriginX = 0; OriginY = 0; Height = 870; Width = 1152;" on my setup.


if you don't want the backticks, yu can exchange them to $( and ) as in below

echo $(defaults read /Library/Preferences/com.apple.windowserver | grep -wA 1 -m 1 OriginX) $(defaults read /Library/Preferences/com.apple.windowserver | grep -w -m 1 Height) $(defaults read /Library/Preferences/com.apple.windowserver | grep -w -m 1 Width)

OriginX = 0; OriginY = 0; Height = 768; Width = 1024; on my setup


Not tested with  'do shell script' but works in the shell. Perhaps the $ needs escaping?

/Björn


 

Björn Lundin


bnl at spray dot se
 



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:


This email sent to email@hidden


Stevan

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (



--
Some minds remain open long enough for a truth to both enter and leave without processing.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: get size of available screen fails (From: Björn Lundin <email@hidden>)
 >Re: get size of available screen fails (From: "Reese, Stevan" <email@hidden>)

  • Prev by Date: Re: How do I delete the 1st three characters from a variable
  • Next by Date: Re: How do I delete the 1st three characters from a variable
  • Previous by thread: Re: get size of available screen fails
  • Next by thread: Re: Need help with image events droplet to save multiple files as png
  • Index(es):
    • Date
    • Thread