Possible to automate search and replace within signatures?

A

adambr3

A friend uses Entourage (Office 2004) for his mail function, and he has
about 80 different signatures that he chooses from, depending on a
variety of factors.

Is there a way for him to be able to do an automated search and replace
within all of the signatures? Perhaps an applescript?

For example, each signature includes the words "Copyright 2005", so
he'd want to change that to "Copyright 2006" in each signature file.
There is also a gif image that would need to be changed as well.

I have a little bit of experience with applescript, although not a lot.


I don't use Entourage, so if it's possible to handle this within the
application, please bear with me, and let me know how it's done so I
can help out my friend.

Thanks very much.

Bonnie
 
B

Barry Wainwright [MVP]

A friend uses Entourage (Office 2004) for his mail function, and he has
about 80 different signatures that he chooses from, depending on a
variety of factors.

Is there a way for him to be able to do an automated search and replace
within all of the signatures? Perhaps an applescript?

For example, each signature includes the words "Copyright 2005", so
he'd want to change that to "Copyright 2006" in each signature file.
There is also a gif image that would need to be changed as well.

I have a little bit of experience with applescript, although not a lot.


I don't use Entourage, so if it's possible to handle this within the
application, please bear with me, and let me know how it's done so I
can help out my friend.

Thanks very much.

Bonnie

You can get the content of a signature by script, and then parse that
content to carry out any text replacements.

This script should search/replace across all signatures...

set searchAnswer to (display dialog "Search signatures for what text?"
default answer return buttons {" Cancel ", "Search"} default button 2)
if button returned of searchAnswer is " Cancel " then return
set searchText to text returned of searchAnswer
set replaceAnswer to (display dialog "Replace search string with what text?"
default answer searchText buttons {" Cancel ", "Replace"} default button 2)
if button returned of replaceAnswer is " Cancel " then return
set replaceText to text returned of replaceAnswer
set oldTIDs to AppleScript's text item delimiters
tell application "Microsoft Entourage"
repeat with aSig in every signature
set AppleScript's text item delimiters to searchText
set sigText to text items of (get content of aSig)
set AppleScript's text item delimiters to replaceText
set content of aSig to (sigText as text)
end repeat
end tell
set AppleScript's text item delimiters to oldTIDs
 

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