WinWaitClose or Keywait Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Loop
Posts: 169
Joined: 07 Jan 2019, 14:51

WinWaitClose or Keywait

Post by Loop » 19 Jan 2022, 14:32

Hi,
is this possible?

Code: Select all

WinWaitClose, VLC media player OR KeyWait, Right, d
Msgbox, yes
Thx

User avatar
boiler
Posts: 16954
Joined: 21 Dec 2014, 02:44

Re: WinWaitClose or Keywait  Topic is solved

Post by boiler » 19 Jan 2022, 14:43

No, but you can do this:

Code: Select all

loop
	Sleep, 20
until !WinExist("VLC media player") || GetKeyState("Right", "P")
MsgBox, yes

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: WinWaitClose or Keywait

Post by swagfag » 19 Jan 2022, 14:47

in normal ahk, no. both commands are blocking waits. ud have to rewrite the logic in terms of an InputHook() for example and a SetTimer checking with WinExist()

in ahk_h, u can fire 2 threads to execute the commands

User avatar
boiler
Posts: 16954
Joined: 21 Dec 2014, 02:44

Re: WinWaitClose or Keywait

Post by boiler » 19 Jan 2022, 14:51

Another version using while, which is a little more compact:

Code: Select all

while WinExist("VLC media player") && !GetKeyState("Right", "P")
	Sleep, 20
MsgBox, yes

Loop
Posts: 169
Joined: 07 Jan 2019, 14:51

Re: WinWaitClose or Keywait

Post by Loop » 19 Jan 2022, 14:52

thanks you

Post Reply

Return to “Ask for Help (v1)”