Page 1 of 1

Bug? HotIfWinActive

Posted: 18 Oct 2021, 00:17
by hyaray

Code: Select all

HotIfWinActive
hotkey("F9", (p*)=>msgbox(11), "on")
F9 not worked
delete HotIfWinActive and worked well :headwall: :headwall:

Re: Bug? HotIfWinActive

Posted: 18 Oct 2021, 00:35
by Hellbent
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?

Re: Bug? HotIfWinActive

Posted: 18 Oct 2021, 00:46
by hyaray
@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

Re: Bug? HotIfWinActive

Posted: 18 Oct 2021, 01:11
by Hellbent
@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*)=> ] ].

Re: Bug? HotIfWinActive

Posted: 18 Oct 2021, 10:26
by hyaray
u can see the help of =>
It's a simple way to create a lambda function without giving a name. :D