[AutoHotkey-jk] How to use hotIf() Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
func
Posts: 47
Joined: 20 May 2016, 20:52

[AutoHotkey-jk] How to use hotIf()

11 Apr 2022, 21:30

How to use hotIf() with this?
Note: I'm not actually trying to just detect if winActive("A"), it's for debugging only, I really need hotIf() instead of hotIfWinActive()
Everything I'm trying with hotIf() is getting an error "Parameter 1 must match an existing #HotIf expression."

Code: Select all

hotIf(winActive("A")) // error
hotIf('winActive("A")') // error
hotIf 'winActive("A")' // error
[Mod action: Moved post to its own thread from an existing thread in “Announcements” and gave it a subject line, which refers to AutoHotkey-jk.]
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: [AutoHotkey-jk] How to use hotIf()

12 Apr 2022, 04:23

hotif wrote: Sets the criteria to an existing #HotIf expression
my bold
I.e., eg,

Code: Select all

hotif 'winactive("a")'
#hoif winactive("a")
Or, pass a function object,

Code: Select all

hotif hk=>winactive('a')
Cheers.
func
Posts: 47
Joined: 20 May 2016, 20:52

Re: [AutoHotkey-jk] How to use hotIf()

12 Apr 2022, 15:17

Accepted it just doesn't work in AHK-JK, had the correct syntax, it's just not working. Found a much more important problem anyway
Last edited by func on 15 Apr 2022, 20:00, edited 1 time in total.
lexikos
Posts: 9635
Joined: 30 Sep 2013, 04:07
Contact:

Re: [AutoHotkey-jk] How to use hotIf()  Topic is solved

14 Apr 2022, 18:19

The following code works with both AutoHotkey-jk (v2.0-a130) and AutoHotkey v2.0-beta.3.

Code: Select all

hotIf(hk => winActive('ahk_class Shell_TrayWnd'))
hotkey('Space', hk => msgBox('Pressed Space with taskbar active'))
i.e. pass a function.

hotIf('winActive("A")') would not work for the reason explained in the documentation.
Sets the criteria to an existing #HotIf expression. ... Although this function is unable to create new expressions, it can create new hotkeys using an existing expression.
There is no way for an expression to exist unless you add #HotIf directives on the AutoHotkey side.

hotIf(winActive("A")) would not work because you are just passing a window ID to hotIf.

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: mikeyww and 39 guests