Skip to content

Instantly share code, notes, and snippets.

@larry801
Created May 11, 2020 04:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save larry801/572a3a09be5e3e8c6130c7c8051edf76 to your computer and use it in GitHub Desktop.
Save larry801/572a3a09be5e3e8c6130c7c8051edf76 to your computer and use it in GitHub Desktop.
让斜杠不再被微软输入法2004版本之后转换成顿号
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
;说明 在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 =
}
}
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
;说明 在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 =
}
}
/:: ;让斜杠不再被微软输入法2004版本之后转换成顿号
ascinput("/")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment