MACSCRPT Archives

October 2011

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Nigel Garvey <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Fri, 14 Oct 2011 11:48:48 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (52 lines)
Christopher Stone wrote on Thu, 13 Oct 2011 03:37:28 -0500:

>On Oct 13, 2011, at 03:09, Nigel Garvey wrote:
>> On my machine, the result comes back visibly much faster if the full
>>reference is used:
>
>______________________________________________________________________
>
>Hey Nigel,
>
>Yeah.  It's about 2/100 sec faster here, which I notice.
>
>How are you getting your reference structure?
>
>Are you reading it with the UIElementInspector or doing something else?

Hi, Christopher.

If you mean how did I know to include 'of menu bar item "Safari"', I was
simply remembering one of the first things I learned in GUI Scripting
when I got my Tiger system six years ago.  :)

I tried your variation of Mark's script yesterday and found it was
taking a second or two to return a result, which was very slow,
particularly on my 2.53 GHz MacBook Pro. When I looked closer and saw
that 'of menu bar item "Safari"' wasn't included in the reference, I
tried changing it to the form with which I was more familiar and was
surprised to get a very much faster result.

That was yesterday. This morning, both versions are returning results
practically instantaneously, although the version I posted is slightly
more instantaneous than the other. The faster times may be connected
with the fact that I received a software update yesterday, which
involved a change from Safari 5.1 to Safari 5.1.1 and a restart of the
computer.

A cross-check with my Tiger/2.0 GHz G5 system (where the script appears
to work even faster!) suggests that 'menu "Safari" of menu bar 1' isn't
actually "wrong" there either. It works in both Tiger and Snow Leopard
and is implied in their System Events dictionaries. However, if it's
simply run as a reference, the fuller reference comes back:

  tell application "System Events"
    menu "Safari" of menu bar 1 of process "Safari"
  end tell
  --> menu "Safari" of menu bar item "Safari" of menu bar 1 of application process "Safari" of application "System Events"

One might hypothesise that more work has to be done to resolve the less
complete reference.

NG

ATOM RSS1 RSS2