Re: get size of available screen fails
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
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