• 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: Getting desktop bounds
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting desktop bounds


  • Subject: Re: Getting desktop bounds
  • From: Kok Ooi Kong <email@hidden>
  • Date: Tue, 5 Aug 2003 06:13:06 +0800

> Subject: Re: Getting desktop bounds (was: Re: Isn't there a way...
> From: Paul Skinner <email@hidden>
> To: AppleScript Users appleScript <email@hidden>
>
> 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 {}.

If you run the script below you will find out that there are actually 2
windows with the position of {0,0}.
---------
copy my desktop_size() to {desktop_width, desktop_height}

on desktop_size()
tell application "System Events"
tell process "Finder"
set frontmost to true
repeat with i from 1 to the count of windows
if the position of window i is {0, 0} then
return the size of window i
end if
end repeat
end tell
end tell
end desktop_size
----------
If you would like the window to be in the center then
tell application "System Events" to set _frontApp to (path to frontmost
application) as Unicode text
copy my desktop_size() to {desktop_width, desktop_height}
tell application _frontApp
set {leftM, topM, rightM, bottomM} to bounds of window 1
set {wdwWidth, wdwHgt} to {(rightM - leftM), (bottomM - topM)}
set bounds of window 1 to {((desktop_width - wdwWidth) / 2),
((desktop_height - wdwHgt) / 2), ((desktop_width + wdwWidth) / 2),
((desktop_height + wdwHgt) / 2)}
activate
end tell

> At 7:55 am -0600 3/8/03, Robert Poland wrote:
>
>>
>> I've been trying to find out what is meant by the line
>>> tell application "System Events" to tell process "Finder" to [option
>>> - l]
>>
>> I've gone through the GUI Scripting manual and got nowhere. Don't
>> see a menu item "Options" under the Finder.

Option-L is "," symbol.
_______________________________________________
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.

  • Prev by Date: Re: compress with resource forks
  • Next by Date: Re: OT: Default Shell in 10.2.6
  • Previous by thread: Re: $HOME/.login
  • Next by thread: Scripting Omnipage
  • Index(es):
    • Date
    • Thread