• 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: Scripting the unscriptable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting the unscriptable


  • Subject: Re: Scripting the unscriptable
  • From: Bill Cheeseman <email@hidden>
  • Date: Tue, 26 Jan 2010 18:05:27 -0500

On Jan 26, 2010, at 2:36 PM, Elliott Roper wrote:

Please can someone tell this newbie why set position and get name work in this script but set bounds doesn't?

if application "Preview" is running then
tell application "System Events"
tell application process "Preview"
set position of window 1 to {-1682, 23}
get name of window 1
set bounds of window 1 to {-1682, 23, -9, 1044}
end tell
end tell
end if

Because 'bounds' is not a valid term in GUI Scripting. Look at the terminology dictionary for the System Events application in AppleScript Editor's dictionary viewer. You will see 'position' and 'size', but not 'bounds'. System Events is located in /System/Library/CoreServices. It is the application you are scripting when you use GUI Scripting.

When you're scripting 'window 1' in GUI Scripting (System Events), you aren't scripting a Finder window object. Instead, you're scripting a System Events 'UI element' object. UI elements don't have bounds. They have position and size.

You can of course accomplish what you're trying to accomplish by setting position and size appropriately.

[Sorry if this is a repost. I'm confused as to whether I accidentally replied to Elliott privately, or publicly as I meant to do.]

--

Bill Cheeseman
email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Scripting the unscriptable (From: Elliott Roper <email@hidden>)

  • Prev by Date: Re: Preview.app scriptable
  • Next by Date: Re: Scripting the unscriptable
  • Previous by thread: Re: Scripting the unscriptable
  • Next by thread: Re: Scripting the unscriptable
  • Index(es):
    • Date
    • Thread