Contacs : mettre en majuscule les noms

phcm64100

Membre actif
Bonjour

j aide une amie a installer son mac, elle a pres de 1000 contacts mais aucune regle dans l ecriture des noms

existe t il un utilitaire qui permet de mettre les Noms en Majuscule ?

merci
 
merci, mais sais pas utiliser les scripts
et ils datent de 2006 peut etre c est plus bon

------------------------------------------

j ai trouvé comment faire, j ai lancé le script, il me dit ok, mais rien n est changé dans le carnet d adresse, les noms sont toujours pas en majuscules
 
Dernière édition par un modérateur:
@phcm64100
Le script fonctionne il manque juste l'enregistrement des modifs
essai avec celui là, j'ai juste ajouté un "save"
Bloc de code:
property lower_alphabet : "abcdefghijklmnopqrstuvwxyzáàâäãåçéèêëíìîïñóòôöõúùûü"
property upper_alphabet : "ABCDEFGHIJKLMNOPQRSTUVWXYZÁÀÂÄÃÅÇÉÈÊËÍÌÎÏÑÓÒÔÖÕÚÙÛÜ"

tell application "Contacts"
    repeat with thisPerson in (get people whose last name is not missing value)
        tell thisPerson to set last name to my change_case(last name)
        set nom to last name of thisPerson
        save
    end repeat
end tell


on change_case(t)
    set C to characters of t
    considering case
        repeat with i in C
            tell (the offset of i in lower_alphabet) to if it > 0 then set contents of i to character it of upper_alphabet
        end repeat
    end considering
    return C as string
end change_case
 
Zeltron merci bcp il a fonctionné
Et aurais-tu le même pour mettre que les premières lettres du nom
par ex : CAZAUX-MOUTOU donnerait ça Cazaux-Moutou

merci à toi
 
Dernière édition par un modérateur:
Voilà un script qui met la première lettre du nom en majuscule ainsi que, dans le nom, les lettres qui suivent un "-", "_", " "
s'il faut ajouter un autre séparateur il suffit de l'ajouter dans la 3ieme ligne : property separ : "-_ "

le script:

Bloc de code:
property lower_alphabet : "abcdefghijklmnopqrstuvwxyzáàâäãåçéèêëíìîïñóòôöõúùûü"
property upper_alphabet : "ABCDEFGHIJKLMNOPQRSTUVWXYZÁÀÂÄÃÅÇÉÈÊËÍÌÎÏÑÓÒÔÖÕÚÙÛÜ"
property separ : "-_ "
tell application "Contacts"
    repeat with thisPerson in (get people whose last name is not missing value)
        tell thisPerson to set last name to my change_case(last name)
        set nom to last name of thisPerson
        save
    end repeat
end tell


on change_case(t)
    set C to characters of t
    set nb to count character of t
    considering case
        repeat with i in C
            tell (the offset of i in upper_alphabet) to if it > 0 then set contents of i to character it of lower_alphabet
        end repeat
        
        set pos to 1
        set maj to 0
        repeat with i in C
            if pos = 1 then
                tell (the offset of i in lower_alphabet) to if it > 0 then set contents of i to character it of upper_alphabet
            else
                if maj = 1 then
                    tell (the offset of i in lower_alphabet) to if it > 0 then set contents of i to character it of upper_alphabet
                    set maj to 0
                end if
                if (i is in separ) then
                    set maj to 1
                end if
                
            end if
            set pos to pos + 1
        end repeat
        
    end considering
    return C as string
end change_case
 
Merci BCP, ca marche super bien

Merci encore
 
Content pour toi !