Intento sustituir una dirección de correo electrónico por un carácter simbólico en un bloque de texto.
El bloque de texto:
Dear %%FirstName%%-
...
This message was sent to %%EmailAddress%%.
El script:
...
set theBody to my replace(theBody, "%%FirstName%%", "First")
set theBody to my replace(theBody, "%%EmailAddress%%", "first.last@company.com")
...
Sustituir el subprocedimiento ( AppleScript: Sub-rutinas esenciales ):
on replace(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace
El resultado:
Dear First-
...
This message was sent to .
Si cambio el script por:
...
set theBody to my replace(theBody, "%%FirstName%%", "First")
set theBody to my replace(theBody, "%%EmailAddress%%", "first.lastATcompany.com")
El resultado:
Dear First-
...
This message was sent to first.lastATcompany.com.
¿Qué pasa con el replace
¿subprocedimiento?
** editar **
Estoy recopilando una lista distinta de direcciones de correo electrónico de un contacto de Outlook:
...
set theAddresses to email addresses of theContact
set addressList to {}
repeat with theAddress in the theAddresses
if addressList does not contain (address of theAddress) then
set addressList to addressList & (address of theAddress)
end if
end repeat
...
Entonces, usando la lista:
...
repeat with theAddress in addressList
...
make new recipient at newMessage with properties {email address:{name:displayName of theContact, address:theAddress}}
...
end repeat
...