• 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
Stripping the target application specifier from an AppleScript object reference
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Stripping the target application specifier from an AppleScript object reference


  • Subject: Stripping the target application specifier from an AppleScript object reference
  • From: "Scott Babcock" <email@hidden>
  • Date: Mon, 2 May 2005 13:16:41 -0700
  • Thread-topic: Stripping the target application specifier from an AppleScript object reference

I have a scenario where I want to take a reference to a System Events
object and send it to a different application. The problem I was having
was that System Events kept throwing a wrench in the works by trying and
failing to perform an unnecessary coercion.

I found that I can strip the target process specifier by coercing a
reference to a list in base context - that is, outside of a 'tell'
block:

    set strippedRef to (item 1 of (originalRef as list))

Once I do this, I have the original reference minus the phrase 'of
application "System Events"'. I can pass this reference around wherever
I want, and System Events is none the wiser.

Once I get this reference to my scriptable application, I can get the
container (parent) of the reference and add the target process specifier
back on, giving me a usable container-object reference.

The question is this: Is the target-stripping side-effect of list
coercion a know behavior, or is this a bug that Apple may "fix" some
day?
 _______________________________________________
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: Need help with MS Word 2004 languages and dictionaries
  • Next by Date: Tiger: Keychain Scripting works?
  • Previous by thread: Raw class specifiers that AppleScript won't mess with
  • Next by thread: Tiger: Keychain Scripting works?
  • Index(es):
    • Date
    • Thread