OVH Cloud OVH Cloud

[AppleScript] Address Book : missing value

2 réponses
Avatar
pere.noel
j'essaie de faire un AS qui retourne en xml le cvontenu de l'Address
Book.

certains champs n'étant pas remplis, ils sont retournés, par Address
Book, comme "missing value".

je voudrais savoir comment tester ça, càd remplacer "missing value" par
"". si je fais :

on trimMissingValue(textToTrim)
if textToTrim = "missing value" then return ""
return textToTrim
end trimMissingValue

j'ai une erreur :
Erreur dans Address Book : Impossible de poursuivre trimMissingValue.

ce n'est donc pas une chaine de caractères qui est retournée...

--
une bévue

2 réponses

Avatar
pere.noel
Une bévue wrote:

on trimMissingValue(textToTrim)
if textToTrim = "missing value" then return ""
return textToTrim
end trimMissingValue


j'ai changé ma subroutine en :

on trimMissingValue(textToTrim)
if textToTrim is missing value or textToTrim is {} then
return ""
else if class of textToTrim is string then
return textToTrim
end if
end trimMissingValue

suivant un exemple de "Late Night Software" :
<http://www.latenightsw.com/freeware/XMLTools2/asUtilities.html>

tjs la même erreur...

--
une bévue

Avatar
pere.noel
Une bévue wrote:

'ai changé ma subroutine en :

on trimMissingValue(textToTrim)
if textToTrim is missing value or textToTrim is {} then
return ""
else if class of textToTrim is string then
return textToTrim
end if
end trimMissingValue

suivant un exemple de "Late Night Software" :
<http://www.latenightsw.com/freeware/XMLTools2/asUtilities.html>

tjs la même erreur...


j'ai contourné le problème par :

set thisDepartment to department of thisPerson
if thisDepartment is missing value then
set thisDepartment to ""
end if

mais est-ce du au fait que c'est à l'intérieur d'un block tell/end tell,
je n'arrive pas à mettre ce test dans une subroutine ???


--
une bévue