• 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: Count's 'each' parameter deprecated?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Count's 'each' parameter deprecated?


  • Subject: Re: Count's 'each' parameter deprecated?
  • From: Nigel Garvey <email@hidden>
  • Date: Wed, 19 Sep 2012 00:23:19 +0100

"koenig.yvan" wrote on Tue, 18 Sep 2012 18:29:42 +0200:

>Le 18/09/2012 à 14:39, Nigel Garvey
<email@hidden> a
>écrit :
>
>> Hi folks.
>>
>> Is it still OK to use the 'each' parameter with 'count'? It still
works
>> in Snow Leopard, but I've just noticed there's no mention of it at all
>> in the 2008 ASLG. Equally, I can't find anything about its demise.

>Hello
>
>As far as I know, each is not a feature of AppleScript but one of the
>Standard Suite supposed to be available in every AppleScript aware
>application.
>So, it's not surprising to see nothing about it in the Guide.

Thanks, Yvan — and Chris. Yes, 'each' is certainly still in the
application dictionaries under 'count' as an application command, so
it's still mentioned somewhere! But it was also given in the 1997 Guide
as an alternative to 'every', along with this language example:

  count each integer in {"Yes", "No", "Maybe", 4, 5, 6}

I think I'll take it as "still OK" in the language context for now,
unless I hear differently.

The reason I'm interested is that, whereas 'every' is part of a
reference, 'each' is a labelled parameter, which makes it possible to
get at its value (the specified class) in an intercept handler. I have a
script object which maintains, amongst other things, a list of values.
One "black box" way to find out how many of a particular class of value
the object's list contains would be this:

  script myObject
    property valueList : {"dog", 1, {}, 2, 7, "aardvark", 98.4}

    on count each thingummy
      return (count my valueList each thingummy)
    end count
  end script

  count myObject each number --> 4
  -- Or:
  -- tell myObject to count each number
  -- (count each number) in myObject


NG

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden


  • Prev by Date: Re: Count's 'each' parameter deprecated?
  • Next by Date: Re: Why does this script NOT error?
  • Previous by thread: Re: Count's 'each' parameter deprecated?
  • Next by thread: Re: applescript SAY command help needed
  • Index(es):
    • Date
    • Thread