Change subject text

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
 
D

Diane Ross

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:

Check out Change the Subject 1.1
Author: Barry Wainwright

A script for Microsoft Entourage (from Office 98 to Office X)
This script will change the subject in an outgoing message window,
and append the previous subject in a bracketed note at the end of
the new subject line. Yes, I know you can do this by hand, but the
script makes it a little easier.

Works with 2004.

<http://scriptbuilders.net/files/changethesubject1.1.html>
--
Diane Ross, Microsoft Mac MVP
Entourage Help Page
<http://www.entourage.mvps.org/>
One of the top five MS Entourage resources listed on the Entourage Blog.
<http://blogs.msdn.com/entourage/>
 
J

Jon Connell

deathdruid said:
s/replace_chars/my replace_chars/

or:

set theContent to my replace_chars(content of theMessage, "foo",
"bar")

Great, thanks! When tied to a rule, I can now do some pretty snazzy
reformatting of some automated notifications that I get.

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top