Code: Select all
; Alt(!) CTRL(^) shift(+) win(#) win(e)
#p:: ; convert to UPPER/LOWERCASE
Convert_Inv()
RETURN
Convert_Inv()
{
Clipboard= ; set clipboard to ctrl+c
Send ^c ; copy highlighted text to clipboard
ClipWait
;MsgBox, %Clipboard%
Inv_Char_Out:= "" ; clear variable that will hold output string
Loop % Strlen(Clipboard) { ; loop for each character in the clipboard
Inv_Char:= Substr(Clipboard, A_Index, 1) ; isolate the character
if Inv_Char is upper ; if upper case
Inv_Char_Out:= Inv_Char_Out Chr(Asc(Inv_Char) + 32) ; convert to lower case
else if Inv_Char is lower ; if lower case
Inv_Char_Out:= Inv_Char_Out Chr(Asc(Inv_Char) - 32) ; convert to upper case
else
Inv_Char_Out:= Inv_Char_Out Inv_Char ; copy character to output var unchanged
}
Clipboard=%Inv_Char_Out%
ClipWait
Send ^v