Re: Getting desktop bounds (was: Re: Isn't there a way...
Re: Getting desktop bounds (was: Re: Isn't there a way...
- Subject: Re: Getting desktop bounds (was: Re: Isn't there a way...
- From: Paul Skinner <email@hidden>
- Date: Sun, 3 Aug 2003 08:37:52 -0400
On Saturday, August 2, 2003, at 02:52 PM, John Delacour wrote:
At 2:16 pm -0700 30/07/03, Allen Watson wrote:
> set bounds of window 1 to {x, y, x + (x2 - x1), y + (x2 - x1)}
John, shouldn't the last part be "(y2 - y1))}"? When I ran your
version my
window extended off the bottom of the screen; when I changed it to
this, it
seemed to work properly.
Well actually it was the line before that I got wrong.
I've now discovered that you don't need to have Jon's commands
installed; the thing can be done using just System Events:-
set _frontapp to (path to frontmost application) as Unicode text
tell app "System Events" to tell process "Finder" to [OPTION-L]
set {dx, dy} to size of windows whose position is {0, 0}
tell app _frontapp
set {x1, y1, x2, y2} to bounds of window 1
set {x, y} to {(dx - (x2 - x1)) / 2, (dy - (y2 - y1)) / 2}
set bounds of window 1 to {x, y, x + (x2 - x1), y + (y2 - y1)}
end
-- JD
Looks like this requires something you have that I don't.
tell application "System Events" to tell process "Finder" to set {dx,
dy} to size of windows whose position is {0, 0}
-->Can't get item 1 of {}.
This works for me...
set {dx, dy} to {(word 3 of (do shell script "defaults read
/Library/Preferences/com.apple.windowserver | grep -w Width")) as
number, (word 3 of (do shell script "defaults read
/Library/Preferences/com.apple.windowserver | grep -w Height")) as
number}
-->{1280, 854}
PS
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.