J
Jon Connell
I'd like to create a rule to alter some URLs in incoming messages
according to a rule. I can match the message and run some AppleScript,
but I can't get my head around why this is failing:
on replace_chars(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_chars
tell application "Microsoft Entourage"
set selectedMessages to current messages
if selectedMessages is {} then
display dialog "Please select a message first and then run this
script." with icon 1
return
end if
repeat with theMessage in selectedMessages
set theContent to replace_chars(content of theMessage, "foo", "bar")
display dialog theContent
end repeat
end tell
The replace_chars() function is lifted off Apple's website, but the
Script Editor says:
tell application "Microsoft Entourage"
get current messages
{incoming message id 106155}
replace_chars(content of incoming message id 106155, "foo", "bar")
"Microsoft Entourage got an error: Can't continue replace_chars."
Can anyone help me figure out what went wrong?
Cheers,
Jon
according to a rule. I can match the message and run some AppleScript,
but I can't get my head around why this is failing:
on replace_chars(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_chars
tell application "Microsoft Entourage"
set selectedMessages to current messages
if selectedMessages is {} then
display dialog "Please select a message first and then run this
script." with icon 1
return
end if
repeat with theMessage in selectedMessages
set theContent to replace_chars(content of theMessage, "foo", "bar")
display dialog theContent
end repeat
end tell
The replace_chars() function is lifted off Apple's website, but the
Script Editor says:
tell application "Microsoft Entourage"
get current messages
{incoming message id 106155}
replace_chars(content of incoming message id 106155, "foo", "bar")
"Microsoft Entourage got an error: Can't continue replace_chars."
Can anyone help me figure out what went wrong?
Cheers,
Jon