Bug? HotIfWinActive

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
User avatar
hyaray
Posts: 85
Joined: 20 Jun 2015, 01:37
Contact:

Bug? HotIfWinActive

18 Oct 2021, 00:17

Code: Select all

HotIfWinActive
hotkey("F9", (p*)=>msgbox(11), "on")
F9 not worked
delete HotIfWinActive and worked well :headwall: :headwall:
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: Bug? HotIfWinActive

18 Oct 2021, 00:35

hyaray wrote:
18 Oct 2021, 00:17

Code: Select all

HotIfWinActive
hotkey("F9", (p*)=>msgbox(11), "on")
F9 not worked
delete HotIfWinActive and worked well :headwall: :headwall:
Never used v2 before, but a quick search for "ahk HotIfWinActive" shows nothing.

So... is HotIfWinActive a thing or do you have a typo?
User avatar
hyaray
Posts: 85
Joined: 20 Jun 2015, 01:37
Contact:

Re: Bug? HotIfWinActive

18 Oct 2021, 00:46

@Hellbent
here is the online document. https://lexikos.github.io/v2/docs/commands/HotIf.htm#IfWin

v2 has #hotif and HotIfWinActive syntax for use.

Code: Select all

; needn't to define function
#hotif WinActive("ahk_class Notepad")
F9::{
msgbox(11)
;multi lines of code
}

Code: Select all

HotIfWinActive("ahk_class Notepad")
hotkey("F9", (p*)=>msgbox(11), "on") ;fits for simple code for func object, looks better
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: Bug? HotIfWinActive

18 Oct 2021, 01:11

@hyaray
Ok ty.
I assume that your problem isn't related to this?
https://lexikos.github.io/v2/docs/commands/Hotkey.htm#variant

If not, I have nothing more to offer as I have never looked at v2 before [ have no idea what this is [ (p*)=> ] ].
User avatar
hyaray
Posts: 85
Joined: 20 Jun 2015, 01:37
Contact:

Re: Bug? HotIfWinActive

18 Oct 2021, 10:26

u can see the help of =>
It's a simple way to create a lambda function without giving a name. :D

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: CraigM, downstairs and 32 guests