Thinkai's Blog

Autohotkey|Python|php|aardio|VOIP|IT 爱好者

ascinput()绕过输入法发送字符函数 Autohotkey 7941

作者为 发表

Autohotkey

;说明 在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%^&*()")



来了就留个评论吧! 1个评论




友情链接:Autohotkey中文帮助Autohotkey官网Autohotkey中文网联系作者免GooglePlay APK下载

 主题设计 • skyfrit.com  Thinkai's Blog | 保留所有权利

60 queries in 2.205 seconds |