• 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: Filter reference form question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Filter reference form question


  • Subject: Re: Filter reference form question
  • From: Nigel Garvey <email@hidden>
  • Date: Tue, 20 Apr 2004 20:23:49 +0100

Michael Terry wrote on Mon, 19 Apr 2004 23:53:01 -0700:

>On Apr 19, 2004, at 10:52 PM, Michael Terry wrote:

>Also, consider the following code:
>
>tell application "Finder"
> get every file of item (choose folder) where my test(its name) is
>"hello"
>end tell
>
>on test(testName)
> display dialog testName
> return testName is "whatever"
>end test
>
>Why does the display dialog show "Finder" rather than some file name?

Because 'its name' isn't part of a Finder reference here, but the
parameter of a call to a handler - whose result is then incorporated into
a reference. 'Choose folder' is similarly just a contributor of a result
for this purpose. Only when the reference is complete does the Finder try
to do anything with it.

In a 'tell' block, 'it' normally refers to the entity being told, which
in this case is the Finder. So you're passing the name of the Finder to
the handler, which obediently displays it. The handler then performs the
test 'testName is "whatever"' - getting 'false' because testName is
"Finder" - and it's this 'false' that's returned to be slotted into the
reference - as you'll see if you look in Script Editor's Event Log:

every file of item (alias "blah:blah:blah:") whose false is "hello"

NG
_______________________________________________
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: multi-dimensional arrays (new to AS)
  • Next by Date: Putting file counts into comments
  • Previous by thread: Re: Filter reference form question
  • Next by thread: FileMaker Pro & Fax
  • Index(es):
    • Date
    • Thread