• 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: Creating a list of numbers from a Contacts group
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating a list of numbers from a Contacts group


  • Subject: Re: Creating a list of numbers from a Contacts group
  • From: Yvan KOENIG <email@hidden>
  • Date: Fri, 06 Jan 2017 16:53:17 +0100


Le 6 janv. 2017 à 13:30, Shane Stanley <email@hidden> a écrit :
…
The ASObjC equivalent of what SD is doing would be:

set phoneNumbers to phoneNumbers's mutableCopy()
phoneNumbers's removeObject:{}
-- and then
set phoneNumbers to phoneNumbers as list

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>


Hello Shane

In my message posted :  jeudi 5 janvier 2017 21:40:22
I used the scheme described above with the handler: 
on deleteItem:anItem fromList:theList
set theArray to current application's NSMutableArray's arrayWithArray:theList
theArray's removeObject:anItem
set unionOfArrays to (theArray's valueForKeyPath:"@unionOfArrays.self") as list
return unionOfArrays
end deleteItem:fromList:

On  vendredi 6 janvier 2017 11:13:39 I posted a revised version after discovering than the removeObject command was useless.
on cleanList:theList
set theArray to current application's NSMutableArray's arrayWithArray:theList
set unionOfArrays to (theArray's valueForKeyPath:"@unionOfArrays.self")
return unionOfArrays as list
end cleanList:

And this morning I discovered that as I no longer used removeObject, using a mutable array wasn't required. So the handler become:
on cleanList:theList
set theArray to current application's NSArray's arrayWithArray:theList
return (theArray's valueForKeyPath:"@unionOfArrays.self") as list
end cleanList:

Am'I just facing a special case or is (theArray's valueForKeyPath:"@unionOfArrays.self") as list really designed to drop the empty lists ?

I just discovered this interesting behavior when I looked carefully what was displayed in the Log events  issued by your ASObjC Explorer.

Maybe it would be useful to return in 10.11 with the old Xcode in which I would find the chapter "NSKeyValueCoding Protocol" named in your Everyday AppleScriptObjC.

Yvan KOENIG running Sierra 10.12.2 in French (VALLAURIS, France) vendredi 6 janvier 2017 16:50:53

 


 _______________________________________________
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

  • Follow-Ups:
    • Re: Creating a list of numbers from a Contacts group
      • From: Christopher Stone <email@hidden>
    • Re: Creating a list of numbers from a Contacts group
      • From: Shane Stanley <email@hidden>
References: 
 >Re: Creating a list of numbers from a Contacts group (From: Nigel Garvey <email@hidden>)
 >Re: Creating a list of numbers from a Contacts group (From: Nigel Garvey <email@hidden>)
 >Re: Creating a list of numbers from a Contacts group (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Creating a list of numbers from a Contacts group
  • Next by Date: A Night for Sal
  • Previous by thread: Re: Creating a list of numbers from a Contacts group
  • Next by thread: Re: Creating a list of numbers from a Contacts group
  • Index(es):
    • Date
    • Thread