Vorangegangen war ein Apfetalk-Posting, worauf das die Antwort war:
(**
© hubionmac.com 2008
Beschreibung:
das Skript fügt allen ausgewählten Kontakten im Adressbuch ein Datum hinzu mit
mit der Bezeichnung "Letzter Kontakt" und setzt dieses Datum auf das aktuelle Datum.
Sollte ein Datum mit dieser Bezeichnung breits exisitieren, wird dieses entsprechend aktualisiert**)
set mydate to current_date()
set DateLabel to "Letzter Kontakt"
tell application "Contacts"
set these to selection
repeat with this in these
if (label of every custom date of this) contains DateLabel then
repeat with the_customdate_id from 1 to (count of every custom date of this)
if label of custom date the_customdate_id of this = DateLabel then exit repeat
end repeat
set value of custom date the_customdate_id of this to mydate
save
else
tell this to set new_custom_date to make new custom date at end of custom dates with properties {label:DateLabel, value:mydate}
save
end if
end repeat
end tell
on current_date()
-- gibt das Datum in dem Format aus: date "Samstag, 27. September 2008 12:00:00 Uhr"
-- was anderes futtert das Adress-Buch anscheinend nicht
set h to current date
set hours of h to 12
set minutes of h to 0
set seconds of h to 0
return h
end current_date
Anpassung für Kipp
(**
© hubionmac.com 2008
Beschreibung:
das Skript fügt allen ausgewählten Kontakten im Adressbuch ein Datum hinzu mit
mit der Bezeichnung "Letzter Kontakt" und setzt dieses Datum auf das aktuelle Datum.
Sollte ein Datum mit dieser Bezeichnung breits exisitieren, wird dieses entsprechend aktualisiert
09.08.2012 Änderung:
Statt des Datumseintrages wird der DatenTyp related names genutzt und vor dem Datum werden noch die Initiale des Users eingefügt.
**)
set mydate to return_firstChars() & " " & (do shell script "date '+%Y-%m-%d'") as text
set DateLabel to "Letzter Kontakt"
tell application "Contacts"
set these to selection
repeat with this in these
if (label of every related name of this) contains DateLabel then
repeat with the_customdate_id from 1 to (count of every related name of this)
if label of related name the_customdate_id of this = DateLabel then exit repeat
end repeat
set value of related name the_customdate_id of this to mydate
save
else
tell this to set new_custom_date to make new related name at end of related names with properties {label:DateLabel, value:mydate}
save
end if
end repeat
end tell
on return_firstChars()
set userName to long user name of (system info)
set m to ""
repeat with w in every word of userName
set m to m & character 1 of w
end repeat
return m as text
end return_firstChars