• 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: How to press a button in a Finder window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to press a button in a Finder window


  • Subject: Re: How to press a button in a Finder window
  • From: Martin Orpen <email@hidden>
  • Date: Sun, 01 Feb 2004 10:59:21 +0000

on 1/2/04 1:36 am, Doug McNutt at email@hidden wrote:

> At 00:15 +0000 2/1/04, Martin Orpen wrote:
>> This works for me:
>>
>> tell application "System Events"
>> tell process "Finder"
>> tell window "Transfer"
>> click button 1
>> end tell
>> end tell
>> end tell
>
> It does indeed. And I thank you.
>
> But how did you figure out that it was button 1? There are four buttons in the
> window. And how did you discover that you "click" a button rather than
> "press"ing it as specified in the Inspector window?

As I mentioned in a previous post, UI scripting has many benefits:

>> 1. It looks good - beautiful chevrons of tell statements zigzagging through
>> your script.
>> 2. The "Wow" factor - as in "wow it worked *that* time"
>> 3. Security - nobody will steal your script as it's guaranteed that it ain't
>> gonna work on anybody else's Mac
>> 4. Insights into the minds of other programmers - "oh, so that's where
>> button 1 is..."

The buttons are usually numbered in the least likely order. If you have 4
buttons in a row in the window bar then the last button reading left to
right is usually button 1 :-)

I haven't got a clue why the UI Element Inspector uses the term "press". I
don't think that the System Events dictionary has a command of the same
name?

Stick to "click" - but don't rely on it because it doesn't always work
either.

And, as Paul Berkowitz mentioned, get yourself a copy of UI Browser from
here:

http://www.prefab.com/uibrowser/

It has a check box that will highlight the selected element for you which
saves a lot of time and guesswork.

Regards

--
Martin Orpen
Idea Digital Imaging Ltd -- The Image Specialists
http://www.idea-digital.com
_______________________________________________
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: Shell-sandwich a file in 2 variable strings
  • Next by Date: Re: Burning a CD
  • Previous by thread: Re: How to press a button in a Finder window
  • Next by thread: Re: Shell-sandwich a file in 2 variable strings
  • Index(es):
    • Date
    • Thread