• 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
AppleScript Challenge
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AppleScript Challenge


  • Subject: AppleScript Challenge
  • From: Brett Kirksey <email@hidden>
  • Date: Mon, 13 Sep 2004 11:24:31 -0400

Okay, my first post of this didn't get a response, so I thought I'd just issue a challenge in the subject line to get someone's (anyone's) attention. :-)

I'm working on a script library saved as an application. I've
ran into something I can't figure out, so I thought one of you
guys may know what's going on.

Here's an example. Let's say you make a script with only the
following code:

    on makeFinderWindow()
        tell application "Finder"
            set bar to make new Finder window
            return bar
        end tell
    end makeFinderWindow

Now save it as a script _application_ named "Foo".

Now make another script with only this code:

    set newWindow to makeFinderWindow() of application "Foo"
    tell application "Finder" to close newWindow

Run this script. It generates an error that <<class brow>>
doesn't understand the close command. If you comment out the
"close window" command, you can see the result of the script is
"Finder window id nn of application 'Foo'".

But if you run the handler makeFinderWindow() from within "Foo",
the result is "Finder window id nn of application 'Finder'". So,
when "Foo" passes the new finder window of "Finder" to the
calling script, it becomes a finder window of "Foo" instead and
then you can't work with it.

I've tried this with several different apps and several
different classes of objects, and it does the same thing. I just
know I'm missing something obvious, so I'm feeling pretty dumb.
Can someone enlighten me?

BTW, I know you can make script libraries out of compiled
scripts instead of apps. Right now, I'm more interested in why
this behavior is occurring than how to get my script library
working.

Thanks
--
Brett
 _______________________________________________
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

  • Follow-Ups:
    • Re: AppleScript Challenge
      • From: Emmanuel <email@hidden>
    • Re: AppleScript Challenge
      • From: Michelle Steiner <email@hidden>
  • Prev by Date: Re: Chevrons test
  • Next by Date: Re: Address Book scripting
  • Previous by thread: Suppress dialog in Finder
  • Next by thread: Re: AppleScript Challenge
  • Index(es):
    • Date
    • Thread