Modify

#2833 assigned Feature Request

macro @funcname

Reported by: anonymous Owned by: Jon
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc:

Description

Please add a macro, variable or something else that will contain the name of the current function.
This is useful for debugging

Func Test($param, $from_line = @ScriptLineNumber)
	ConsoleWrite('Executing function: ' @funcname & ' calling from ' & $from_line & ' line' & @CRLF)

EndFunc

Attachments (0)

Change History (10)

comment:1 by mLipok, on Aug 11, 2014 at 10:49:04 AM

Some time ago I made to this functionality, my own solution.
Maybe from here also shows a large number of issue found by me, I just have a good additional diagnostic tools of my own scripts.

But the native solution sounds promising.

comment:2 by Jpm, on Aug 11, 2014 at 6:23:17 PM

Type: BugFeature Request

comment:3 by TicketCleanup, on Aug 11, 2014 at 7:00:02 PM

Version: 3.3.12.0

Automatic ticket cleanup.

comment:4 by BrewManNH, on Aug 11, 2014 at 9:47:37 PM

There is a tool in the Tools menu in Scite, if you've installed the full version of SciTE4AutoIt3, that allows you to add a function trace line to every function, you might be able to modify that to create a variable instead of the ConsoleWrite line that it does now.

comment:5 by Zinthose, on Dec 21, 2016 at 6:41:39 AM

I'm surprised this hasn't been added yet.

I'm working on some pretty insane deep nested functions and was trying to do something like This:

If IsString($Variable) And IsDeclared($Variable) Then
  Return Execute(@FuncName & "($" & $Variable & ")")
EndIf

This is to address an issue when resolving a variable name using Eval from a global array. The problem is any changes are saved to the local copy made with Eval and not the original variable from the global scope.

I guess ideally I'd like to see Eval have a ByRef parameter to address my issue but I'd still like to see @FuncName implemented.

comment:6 by jchd18, on Dec 21, 2016 at 11:29:20 AM

If this is ever considered for actual implementation I believe that a macro @CallStack would be even more useful, returning an array of functions called in decreasing depth order (LIFO mode).
If the associated overhead is going to block making that real, perhaps it's time to have an Opt() switching that on for those who need it.

comment:7 by BrewManNH, on Dec 22, 2016 at 1:24:44 PM

Zinthose, I think you misunderstood the request or you're trying to implement it in the worst way possible.
What the request is asking for is to have a macro that tells you the currently executing function, which I don't think would be at all useful because it's just as easy to include a variable set to the name of the function to do exactly the same thing, but would require a coder to have to think for themselves.
Your request is trying to rerun the current function. I'm not sure of what you think you're attempting, but I don't see that as a smart way to do it.

in reply to:  1 comment:8 by mLipok, on Aug 18, 2020 at 4:07:18 PM

Replying to mLipok:

But the native solution sounds promising.

My 2 cents after 6 year of thinking: I do not think that @funcname is necesary.

btw.
Similar closed requests are here:
https://www.autoitscript.com/trac/autoit/ticket/3766
https://www.autoitscript.com/trac/autoit/ticket/2963

Last edited on Aug 25, 2020 at 8:42:20 PM by mLipok (previous) (diff)

comment:9 by Jpm, on Aug 25, 2020 at 3:24:41 PM

Owner: set to Jpm
Status: newassigned

Hi, I sent a fix to Jon
the macroname is @ScriptFuncName

comment:10 by Jpm, on Mar 16, 2024 at 12:55:47 PM

Owner: changed from Jpm to Jon

Modify Ticket

Action
as assigned The owner will remain Jon.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.