I'm trying to make a hotkey, which activates only if the foo() and bar() functions returns a non-zero value.
The Hotkey "If", FunctionObject should help solve the problem, but if I press a hotkey in this example it will result in an error.
Code: Select all
#SingleInstance force
#Persistent
#UseHook
boo( () => (foo() && bar()) )
return ; end of autoexec section
boo(a)
{
b := Func("baz").bind("test")
Hotkey "If", a
Hotkey "vk31", b ; 1 key
}
foo()
{
return 1
}
bar()
{
return 0
}
baz(a)
{
MsgBox a
}
Error
Why the hotkey activates despite the fact that bar() returns 0?What is the reason of error? The arrow points to return on the end of autoexecute section and I'm nowhere passing params more than necessary.
Thanks!