AutoHotKey在发送SendInput指令时会自动发送其他其他按键,如何避免这种问题? Topic is solved

遇到了问题?请先进行搜索(中文和英文),然后在此提问

Moderators: tmplinshi, arcticir

MirrorAZ

AutoHotKey在发送SendInput指令时会自动发送其他其他按键,如何避免这种问题?  Topic is solved

Post by MirrorAZ » 10 Dec 2021, 21:30

代码如下,功能仅仅是快速按两下E键

Code: Select all

#IfWinActive
#Persistent
#MenuMaskKey vkFF
#InstallKeybdHook
#InstallMouseHook
#KeyHistory 100
SetBatchLines -1
ListLines Off
KeyHistory

*XButton1::
    SendInput {E down}
    Sleep 20
    SendInput {E up}
    Sleep 150
    SendInput {E down}
    Sleep 20
    SendInput {E up}
return
可在KeyHistory 却发现AHK自己发送了LShift按键,尽管这是被AHK忽略的,可在实际的使用仍然有被发送并体现出来。如何让AHK不生成这些按键指令呢?

Code: Select all

The oldest are listed first.  VK=Virtual Key, SC=Scan Code, Elapsed=Seconds since the previous event.  Types: h=Hook Hotkey, s=Suppressed (blocked), i=Ignored because it was generated by an AHK script, a=Artificial, #=Disabled via #IfWinActive/Exist, U=Unicode character (SendInput).
A0  02A	i	d	0.00	LShift         	
45  012	i	d	0.00	e              	
A0  02A	i	u	0.00	LShift         	
A0  02A	i	d	0.02	LShift         	
45  012	i	u	0.00	e              	
A0  02A	i	u	0.00	LShift         	
05  000	s	u	0.13	XButton1       	
A0  02A	i	d	0.03	LShift         	
45  012	i	d	0.00	e              	
A0  02A	i	u	0.00	LShift         	
A0  02A	i	d	0.02	LShift         	
45  012	i	u	0.00	e              	
A0  02A	i	u	0.00	LShift         	

wz520
Posts: 29
Joined: 01 Jan 2014, 21:32
Location: China

Re: AutoHotKey在发送SendInput指令时会自动发送其他其他按键,如何避免这种问题?

Post by wz520 » 22 Jan 2022, 01:02

把大写的 E 改成小写的 e 试试

jimzhangao
Posts: 1
Joined: 23 Feb 2022, 02:51

Re: AutoHotKey在发送SendInput指令时会自动发送其他其他按键,如何避免这种问题?

Post by jimzhangao » 23 Feb 2022, 02:57

在按键序列的首个项目前加上{blind}
比如sendinput {blind}{E down}

Post Reply

Return to “请求帮助”