;说明 在QQ聊天窗口中是乱码,需要发送UTF-16BE编码
ascinput(string){
u := A_IsUnicode ? 2 : 1 ;Unicode版ahk字符长度是2
length:=StrPut(string,"CP0")
if(A_IsUnicode)
{
VarSetCapacity(address,length),StrPut(string,&address,"CP0")
}
else
address:=string
VarSetCapacity(out,2*length*u)
index =0
Loop
{
index += 1
if (index>length-1)
Break
asc := NumGet(address,index-1,"UChar")
if asc > 126
{
index += 1
asc2 := NumGet(address,index-1,"UChar")
asc := asc*256+asc2
}
Send, % "{ASC " asc "}"
}
}
ascaltinput(string){
u := A_IsUnicode ? 2 : 1 ;Unicode版ahk字符长度是2
length:=StrPut(string,"CP0")
if(A_IsUnicode)
{
VarSetCapacity(address,length),StrPut(string,&address,"CP0")
}
else
address:=string
VarSetCapacity(out,2*length*u)
index =0
Loop
{
index += 1
if (index>length-1)
Break
asc := NumGet(address,index-1,"UChar")
if asc > 126
{
index += 1
asc2 := NumGet(address,index-1,"UChar")
asc := asc*256+asc2
}
StringSplit, var, asc,
Loop % var0
{
str .= "{Numpad" var%A_index% "}"
}
send, {AltDown}%str%{Altup}
str =
}
}
#z:: ;测试
ascinput("你m啊12234%^&*()")
60 queries in 1.430 seconds |