How can I tell if a function exists? Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

How can I tell if a function exists?

Post by arcticir » 11 Jul 2021, 17:19

I use the H version of the addScript function, which automatically generates functions.
Before calling a function, it will use isfunc("__func_" fn_id) to judge, if not, then use addScript to generate this function.
However, in V2-138, I tried various methods that generate an error: "Error: Variable not found."
type(__func_%fn_id%)
isset(__func_%fn_id%)


I tried using "#Warn All, Off" with no effect either.
How do I turn off the error reporting, or how do I determine if the function exists?

User avatar
Onimuru
Posts: 107
Joined: 08 Sep 2018, 18:35
Contact:

Re: How can I tell if a function exists?  Topic is solved

Post by Onimuru » 11 Jul 2021, 17:58

I would just use a try/catch block for that.

arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

Re: How can I tell if a function exists?

Post by arcticir » 11 Jul 2021, 19:17

Onimuru wrote:
11 Jul 2021, 17:58
I would just use a try/catch block for that.
Thanks.

Post Reply

Return to “Ask for Help (v2)”