Title: Re: Bulk editing of Signatures?
On or near 4/26/02 6:32 AM, Dave Mancuso at [EMAIL PROTECTED] observed:

Before I go doing this by hand, is there any way I can find and replace two pieces of text in all of my signatures at once? I need to change my phone extension and email address in all of my random sigs. I put the file into BBEdit and fooled around with it, but it lost all the carriage returns when I put it back....

I like the idea. Paul's script is good for the specific case. Here's a generic script to globally ind/replace anything in all of your sigs.

-- routine to do a search and replace on text
on
SearchReplace(mainString, searchString, replaceString) -- Parameters: search, replace, the String
   set
olddelis to AppleScript's text item delimiters
   
    set AppleScript's text item delimiters to (
searchString)
    set
theList to (every text item of mainString)
    
    set AppleScript's text item delimiters to (
replaceString)
    set
theString to theList as string
   
    set AppleScript's text item delimiters to
olddelis
   return theString
end SearchReplace

on run
   --
Perform a global find and replace on all signatures
   display dialog ¬
        "Perform a global find and replace on all signatures?" buttons {"Quit", "Continue"} default button 2
   set
ans to button returned of result
   if
ans = "Quit" then return
   set
toFind to text returned of (display dialog "Find what?" default answer "" buttons {"Okay"})
    set
toReplace to text returned of (display dialog "Replace with what?" default answer "" buttons {"Okay"})
    set
thumbsUp to button returned of (display dialog "Replace \"" & ¬
        
toFind & "\" with \"" & toReplace & "\"?" buttons {"No", "Yes"} default button "Yes")
    if
thumbsUp = "Yes" then
       tell application "Microsoft Entourage"
            set
theSigs to every signature
           set
fixedCount to 0
           repeat with
aSig in theSigs
               set c to the content of aSig
               set fixedContent to my SearchReplace(c, toFind, toReplace)
                considering case
                   if
fixedContent is not equal to c then
                       set the content of
aSig to fixedContent
                       set fixedCount to fixedCount + 1
                   end if
               end considering
           end repeat
       end tell
       display dialog "" &
fixedCount & " sigs changed."
    else
       display dialog "Operation cancelled." giving up after 5
   end if
end
run
--
My web page: <http://home.earthlink.net/~allenwatson/>
My scripts page: <http:homepage.mac.com/allenwatson>
Microsoft MVP for Mac Entourage/Word--<[EMAIL PROTECTED]>

Reply via email to