• 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
Raw class specifiers that AppleScript won't mess with
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Raw class specifiers that AppleScript won't mess with


  • Subject: Raw class specifiers that AppleScript won't mess with
  • From: "Scott Babcock" <email@hidden>
  • Date: Mon, 2 May 2005 12:57:15 -0700
  • Thread-topic: Raw class specifiers that AppleScript won't mess with

I've been working with System Events on Panther and was coding around a
bug in which [tab group] objects return the wrong ID when you ask them
for their class. The actual class is <<class tabg>>, but they're
reported as <<class tab >>. My initial attempt to deal with this looked
thus:

    set theClass to class of theElement
    if (theClass is <<class tab >>) then
        set theClass to <<class tabg>>
    end if

When I compile this code for the first time, AppleScript produces the
correct Apple Events, but it "helpfully" changes my code to this:

    set theClass to class of theElement
    if (theClass is tab) then
        set theClass to <<class tabg>>
    end if

If I compile this code again, the 'tab' gets interpreted as the
predefined variable and produces an ASCII 0x09 (TAB) character instead
of the desired Apple Event.

Here's the solution I arrived at. Can anyone see any issues with this?

    property class_tab : run script "<<class tab >>"

    set theClass to class of theElement
    if (theClass is my class_tab) then
        set theClass to <<class tabg>>
    end if

Since the [class_tab] property is initialized at compile time, there's
no run-time consequence for the 'run script' event. Since the class
specifier is expressed as a string, AppleScript doesn't mess with it.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Scripting Mail App
  • Next by Date: Re: Need help with MS Word 2004 languages and dictionaries
  • Previous by thread: Re: Image Events and Unicode
  • Next by thread: Stripping the target application specifier from an AppleScript object reference
  • Index(es):
    • Date
    • Thread