Can I Get the Name of the Running Handler?

How can I get the name of the running handler?

name of me returns the name of the script file.
But I don’t see a way to get the handler’s name.

Any ideas?


set scriptFileName to name of me
--> "My Test Script"

### HOW DO I GET THE NAME OF THE EXECUTING HANDLER? ###

on myHandler()
	
	--- THIS DOESN'T WORK ---
	set handlerName to name of handler
	
end myHandler

Handlers are variables for an action and have no native properties.

Can’t you just set handlerName to myHandler?

Handler names cannot be retrieved at run time like in many programming languages. However some programming languages have compiler macro’s like FUNCTION which will be replaced by a string at compile time. Also programming languages who are text interpreted can get the current handler/function name. But with byte code interpreters, like AppleScript, the handler name doesn’t need to be the same at runtime, and most of the time it isn’t.

@Marc and @DJ, thanks for confirming that you can’t get the name of the handler in AppleScript.