Code: Select all
sendinput, ^c
tempvar := clipboard
stringupper, tempvar, tempvar
clipboard := tempvar
sleep, 100
sendinput, ^v
I need to ensure that in any other case I run this script by mistake (like when file is selected) it will DO NOTHING
Code: Select all
sendinput, ^c
tempvar := clipboard
stringupper, tempvar, tempvar
clipboard := tempvar
sleep, 100
sendinput, ^v
Code: Select all
clipboard := ""
sendinput, ^c
ClipWait, 1
tempvar := clipboard
if (!ErrorLevel && RegExMatch(tempvar, "[a-z]")) {
stringupper, tempvar, tempvar
clipboard := tempvar
sleep, 100
sendinput, ^v
}
Generally, you should create a new thread for a new topic, but I'll answer this. The script below takes what's in the clipboard and puts the converted string back into the clipboard:ik4u wrote: ↑05 Jun 2020, 14:25I need help with this:
1) text in clipboard
2) 1st 2 characters (max 3 characters) convert alphabet to number (A=1, B=2 C=3.....Z=26), and number to alphabet (1=A, 2=B, 3=C....26=Z)
3) convert word (any word) uppercase to lower and lower to uppercase ( D5 SmILE = 4E sMile , 15B crAZY = O2 CRazy , Z12 TONIGHT = 26L tonight)
4) once converted will be entered at the macro recorded location
thanks
Code: Select all
RegExMatch(Clipboard, "([a-zA-Z]+|\d+)([a-zA-Z]+|\d+) ([a-zA-Z]+)", M)
Clipboard := AlphaNumSwap(M1) . AlphaNumSwap(M2) . " " . UpperLowerSwap(M3)
return
AlphaNumSwap(s) {
if s is number
return Chr(s + 64)
else
return Ord(s) - 64
}
UpperLowerSwap(s) {
loop, % StrLen(s) {
t := SubStr(s, A_Index, 1)
if t is upper
StringLower, t, t
else
StringUpper, t, t
u .= t
}
return u
}
Users browsing this forum: No registered users and 190 guests