Keep sending keys only if a window is Active Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
rspai
Posts: 9
Joined: 15 Oct 2019, 03:38

Keep sending keys only if a window is Active

27 Jan 2020, 10:46

I want to keep sending the key "x" every 400 milli seconds if the Active Window is MediaPlayerClassicW
that is:

Code: Select all

#IfWinActive ahk_class MediaplayerclassicW
If a window other than Mediaplyerclassicw becomes Active, the key "x" should not be sent.

Thanks in advance for the help.
cefay
Posts: 56
Joined: 26 Jan 2020, 12:53

Re: Keep sending keys only if a window is Active

27 Jan 2020, 16:10

without testing:


SetTimer, Label, 400

Label:
if WinActive(ahk_class MediaplayerclassicW)
send x
return


rspai
Posts: 9
Joined: 15 Oct 2019, 03:38

Re: Keep sending keys only if a window is Active

27 Jan 2020, 21:52

cefay wrote:
27 Jan 2020, 16:10
without testing:


SetTimer, Label, 400

Label:
if WinActive(ahk_class MediaplayerclassicW)
send x
return


Not working
cefay
Posts: 56
Joined: 26 Jan 2020, 12:53

Re: Keep sending keys only if a window is Active

28 Jan 2020, 05:05

lol. I showed you what you have to do to succeed. I won't do everything for you
gregster
Posts: 9111
Joined: 30 Sep 2013, 06:48

Re: Keep sending keys only if a window is Active  Topic is solved

28 Jan 2020, 05:36

The syntax is not correct. Literal strings need quotation marks around them in expressions:
if WinActive("ahk_class MediaplayerclassicW")
rspai
Posts: 9
Joined: 15 Oct 2019, 03:38

Re: Keep sending keys only if a window is Active

28 Jan 2020, 10:51

cefay wrote:
28 Jan 2020, 05:05
lol. I showed you what you have to do to succeed. I won't do everything for you
Thanks

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Ralf_Reddings200244 and 294 guests