1

Тема: AHK: Как заставить клавишу не вызывать саму себя?

Пробовал по всякому, например так:

$LAlt::Send <!/

происходит бесконечная посылка <!/

2

Re: AHK: Как заставить клавишу не вызывать саму себя?

Не происходит, если записать код как есть в вашем примере. И не должно.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

3

Re: AHK: Как заставить клавишу не вызывать саму себя?

teadrinker
По всей видимости проблема проявляется только в PyCharm.

Lines most recently executed:

+ открыть спойлер

Script lines most recently executed (oldest first).  Press [F5] to refresh.  The seconds elapsed between a line and the one after it is in parentheses to the right (if not 0).  The bottommost line's elapsed time is the number of seconds since it executed.

---- C:\Users\mkone\scripts\ahk\alt_remap\toForum.ahk
001: Return (4.09)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return (0.02)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.02)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.01)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.02)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.02)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.01)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.02)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.01)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.02)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.03)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.02)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.02)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.01)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.02)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.01)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.03)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.01)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.03)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.01)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.02)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.01)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.02)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.02)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.01)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.02)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.02)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.01)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.03)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.02)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.02)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.01)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.02)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (0.02)
001: SetKeyDelay,-1
001: Send,{Blind}<!{/ DownR}
001: Return
001: SetKeyDelay,-1
001: Send,{Blind}{/ Up}
001: Return (9.77)

KeyHistory:

+ открыть спойлер

Window: C:\Users\mkone\scripts\ahk\alt_remap\toForum.ahk - AutoHotkey v1.1.32.00
Keybd hook: yes
Mouse hook: no
Enabled Timers: 0 of 0 ()
Interrupted threads: 0
Paused threads: 0 of 0 (0 layers)
Modifiers (GetKeyState() now) = LShift 
Modifiers (Hook's Logical) = LShift 
Modifiers (Hook's Physical) = 
Prefix key is down: no

NOTE: To disable the key history shown below, add the line "#KeyHistory 0" anywhere in the script.  The same method can be used to change the size of the history buffer.  For example: #KeyHistory 100  (Default is 40, Max is 500)

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).

VK  SC	Type	Up/Dn	Elapsed	Key		Window
-------------------------------------------------------------------------------------------------------------
A4  038	h	d	0.02	LAlt           	
A0  02A	i	d	0.00	LShift         	
A4  038	h	u	0.00	LAlt           	
BC  033	i	d	0.00	,              	
BC  033	i	u	0.00	,              	
A0  02A	i	u	0.00	LShift         	
A4  038	i	d	0.00	LAlt           	
DC  02B	i	d	0.00	/              	
A4  038	i	u	0.00	LAlt           	
DC  02B	i	u	0.00	/              	
A4  038	h	d	0.01	LAlt           	
A4  038	h	u	0.00	LAlt           	
A0  02A	i	d	0.00	LShift         	
BC  033	i	d	0.00	,              	
BC  033	i	u	0.00	,              	
A0  02A	i	u	0.00	LShift         	
A4  038	i	d	0.00	LAlt           	
DC  02B	i	d	0.00	/              	
A4  038	i	u	0.00	LAlt           	
DC  02B	i	u	0.00	/              	
A4  038	h	d	0.02	LAlt           	
A4  038	h	u	0.00	LAlt           	
A0  02A	i	d	0.00	LShift         	
BC  033	i	d	0.00	,              	
BC  033	i	u	0.00	,              	
A0  02A	i	u	0.00	LShift         	
A4  038	i	d	0.00	LAlt           	
DC  02B	i	d	0.00	/              	
A4  038	i	u	0.00	LAlt           	
DC  02B	i	u	0.00	/              	
A4  038	h	d	0.02	LAlt           	
A0  02A	i	d	0.00	LShift         	
A4  038	h	u	0.00	LAlt           	
BC  033	i	d	0.00	,              	
BC  033	i	u	0.00	,              	
A4  038	i	d	0.00	LAlt           	
DC  02B	i	d	0.00	/              	
A4  038	i	u	0.00	LAlt           	
A0  02A	i	d	0.00	LShift         	
DC  02B	i	u	0.00	/      


4

Re: AHK: Как заставить клавишу не вызывать саму себя?

Ну значит он сам как-то клавиатурные посылы обрабатывает.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

5

Re: AHK: Как заставить клавишу не вызывать саму себя?

mkone112 пишет:

Lines most recently executed:

mkone112 пишет:

KeyHistory:

Чем записать также историю нажатий клавиш в скрипте?

6

Re: AHK: Как заставить клавишу не вызывать саму себя?

fgslm
Double Click на иконке скрипта в трее -> view

7

Re: AHK: Как заставить клавишу не вызывать саму себя?

teadrinker
В общем пока, я решил это так:


LAlt::
KeyWait, LAlt
if (A_PriorKey == "LAlt" && A_TimeSinceThisHotkey < single_press_time)
{
    if ( WinActive("ahk_class SunAwtFrame") || WinActive("ahk_class SunAwtDialog") )
    {
        key_seq := ["{LAlt Down}", "{VKBF Down}", "{VKBF Up}", "{LAlt Up}"]
        for i, key in key_seq
        {
            Send, %key%
            Sleep, %key_delay%
        }
    }
}
return