Title: Re: Using Word Caps
On 12/29/04 1:42 PM, "revDAVE" <[EMAIL PROTECTED]> wrote:
> Q: Is there some way to set this current selection as - word caps? If not -
> Is there any body that knows how to create a little AppleScript that can do
> this - ( take the currently highlighted selection and change it to word
> caps)?
It's not super-fast, but it works. It treats spaces and line-endings only as word separators, and won't work with non-Western European text.
tell application "Microsoft Entourage"
activate
try
set s to selection
if class of s is not Unicode text then error number -128
if {class of window 1} is not in {draft window, draft news window} then error number -128
on error
beep
display dialog "First select some text in a new message window." buttons {"Cancel"} with icon 0
return
end try
end tell
set s to s as string
set theLines to paragraphs of s
set AppleScript's text item delimiters to {" "}
repeat with i from 1 to count theLines
set aLine to item i of my theLines
set wds to text items of aLine
repeat with j from 1 to (count wds)
set aWord to item j of my wds
if (count of aWord) > 0 then
set char1 to character 1 of aWord
set num to ASCII number of char1
if num > 96 and num < 123 then
set char1 to ASCII character (num - 32)
if (count of aWord) > 1 then
set aWord to char1 & text 2 thru -1 of aWord
else
set aWord to char1
end if
set item j of my wds to aWord
end if
end if
end repeat
set item i of my theLines to wds as string
end repeat
set AppleScript's text item delimiters to {return}
set s to theLines as string
set AppleScript's text item delimiters to {""}
tell application "Microsoft Entourage"
set selection to s
end tell
--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>
PLEASE always state which version of Microsoft Office you are using - **2004**, X or 2001. It's often impossible to answer your questions otherwise.
- Re: Using Word Caps Paul Berkowitz
- Re: Using Word Caps revDAVE
- Re: Using Word Caps Larry Stone
- Re: Using Word Caps Allen Watson
- Re: Using Word Caps Paul Berkowitz
