Mar 22, '10 07:30:00AM • Contributed by: robleach
display dialog "Enter value to append to Notes of selected Address Book Cards" default answer "" buttons {"Cancel", "OK"} default button 2
set the append_string to the text returned of the result
tell application "Address Book"
activate
set thePeople to selection
repeat with thePerson in thePeople
set noteValue to note of thePerson
try
set theLastCharPos to length of noteValue
on error
set noteValue to ""
set theLastCharPos to length of noteValue
end try
if theLastCharPos is greater than 0 then
set theCharacter to character theLastCharPos of noteValue
if "
" contains theCharacter then
set newNoteValue to noteValue & append_string
else if theLastCharPos is greater than 1 then
set newNoteValue to noteValue & ";" & append_string
else if theLastCharPos is equal to 1 and " " contains theCharacter then
set newNoteValue to append_string
else
set newNoteValue to noteValue & ";" & append_string
end if
else
set newNoteValue to append_string
end if
set note of thePerson to newNoteValue
end repeat
end tellIf there's a script out there that does this already, I could not find it. Also, I'm not very familiar with AppleScript, so I know that there are some pretty dumb things I did in this script (improvements are encouraged in replies).
[robg adds: This worked as described in my testing.]
