Estoy intentando 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 guión:
...
set theBody to my replace(theBody, "%%FirstName%%", "First")
set theBody to my replace(theBody, "%%EmailAddress%%", "[email protected]")
...
Reemplace el sub-procedimiento ( 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 a:
...
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é está mal con el sub-procedimiento replace
?
** editar **
Estoy recopilando una lista 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
...
Luego usa la lista:
...
repeat with theAddress in addressList
...
make new recipient at newMessage with properties {email address:{name:displayName of theContact, address:theAddress}}
...
end repeat
...