To use this: Set the script to a hot key in Macro Scheduler. Open some text editor such as Word, Outlook or Notepad and highlight some text. Finally, press the hot key combination. The first character in each word of
the text phrase should become upper case and the highlight should go away.
Hope someone finds this useful.
Dick
Code: Select all
/*
Usage:
Set this script to a hot key. Highlight some text then press
the hot key combination. The first character in each word of
the text phrase should become upper case.
*/
VBSTART
VBEND
GetClipBoard>vOldData
Press ctrl
Send>c
Release Ctrl
WaitClipBoard
Wait>0.1
GetClipBoard>vData
Let>delimiter=space
Separate>vData,delimiter,vItem
Let>vNewPhrase=
Let>vRegVar_2=
Let>quote="
Let>kk=0
Repeat>kk
Add>kk,1
Let>value=vItem_%kk%
Label>ReValue
Midstr>value,1,1,vChar
If>{(%vChar%=%quote%)or(%vChar%="'")or(%vChar%="(")or(%vChar%="[")or(%vChar%="{")or(%vChar%="|")}
MidStr>value,2,9999999,value
Let>vNewPhrase=%vNewPhrase%%vChar%
Goto>ReValue
EndIf
VBEval>asc("%vChar%"),vChar
If>{((%vChar%>64)and(%vChar%<91))or((%vChar%>96)and(%vChar%<123))}
RegEx>\b[a-z],value,0,vRegVar,vRegNum,1,,vRegRes
Else
Let>vNewPhrase=%vNewPhrase%%value%%delimiter%
Goto>GoToNext
EndIf
If>vRegNum=0
Let>vNewPhrase=%vNewPhrase%%value%%delimiter%
Goto>GoToNext
EndIf
UpperCase>vRegVar_1,vFirstChar
LowerCase>vRegRes,vLastChars
If>vRegVar_2<>
LowerCase>vRegVar_2,vRegVar_2
Let>vNewPhrase=%vNewPhrase%%vFirstChar%%vLastChars%%vRegVar_2%%delimiter%
Else
Let>vNewPhrase=%vNewPhrase%%vFirstChar%%vLastChars%%delimiter%
EndIf
Label>GoToNext
Let>vRegVar_1=
Let>vRegVar_2=
Let>vRegRes=
Let>vFirstChar=
Let>vLastChars=
Until>kk=vItem_Count
Length>vNewPhrase,vLen
Sub>vLen,1
Midstr>vNewPhrase,1,vLen,vNewPhrase
PutClipBoard>vNewPhrase
WaitClipBoard
Wait>0.1
Press ctrl
Send>v
Release ctrl
Wait>1
PutClipBoard>vOldData