• 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: Thu, 05 Jan 2017 18:45:07 +0100


Le 5 janv. 2017 à 17:31, David Crowe <email@hidden> a écrit :

This does the trick purely in AppleScript using the Satimage OSAX:

tell application "Contacts"
tell group "Family"
set phoneNumList to value of every phone of every person
end tell

end tell
try
quoted form of phoneNumList
on error e
set phoneNumList to splittext e using "[ {}A-Za-z'\\\\‘’\\\",\\.]+" with regexp
end try
set AppleScript's text item delimiters to return
return phoneNumList as string


One of the ugly things about this is that if you want to get “\\” into a regular _expression_ you have to quote it twice. 

So AppleScript converts \\\\ into \\ and converts \\\” into \”, and \\. into \. within the regular _expression_.

You also end up with a blank line at the beginning and the end.

- David Crowe



It seems that there is a problem with our regex instruction.
Here, it returns :
tell current application
splittext "Il est impossible d’obtenir quoted form of {{\"0645914322\"}, {}, {\"06 46 60 33 66\", \"06 45 24 95 66\"}, {\"00 (1) 605 532 66 23\"}, {}, {}, {\"06 26 19 63 14\"}, {\"02 33 66 53 15\", \"06 32 26 56 10\"}, {\"06 92 09 96 92\"}, {\"06 93 63 96 40\", \"06 26 13 60 65\"}, {}, {}, {\"03 56 96 96 04\", \"06 61 55 31 60\"}, {\"01 66 62 11 15\", \"06 10 01 05 00\"}, {\"06 93 44 06 62\"}, {\"06 55 60 09 66\"}, {\"01 65 51 29 06\", \"06 26 61 53 43\", \"01 36 56 56 50\"}, {}, {}, {\"06 46 52 05 29\"}, {\"06 49 56 09 39\"}, {\"02 33 04 93 94\"}}." using "[ {}A-Za-z'\\\\‘’\\\",\\.]+" with regexp
end tell

Résultat :

"
0645914322
06
46
60
33
66
06
45
24
95
66
00
(1)
605
532
66
23
06
26
19
63
14
02
33
66
53
15
06
32
26
56
10
06
92
09
96
92
06
93
63
96
40
06
26
13
60
65
03
56
96
96
04
06
61
55
31
60
01
66
62
11
15
06
10
01
05
00
06
93
44
06
62
06
55
60
09
66
01
65
51
29
06
06
26
61
53
43
01
36
56
56
50
06
46
52
05
29
06
49
56
09
39
02
33
04
93
94
"
Don't try to use the phone numbers, they are anonymized ;-)

Yvan KOENIG running Sierra 10.12.2 in French (VALLAURIS, France) jeudi 5 janvier 2017 18:45:02




 _______________________________________________
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: 10.12.2 permission errors when saving
  • Next by Date: Re: Creating a list of numbers from a Contacts group
  • 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