Retrieve current Macro Name?

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Retrieve current Macro Name?

Postby evanevery » Fri Sep 06, 2024 3:36 pm

Anyone aware of a method to return the name of the Macro which is currently executing? (IOW: a method for a macro to determine its own name)

I've been using the Macro Name in the title bar of any messages I display (for clarity). I've been using a locally defined variable to hold the macro name/ID. However, since many folks will change the macro name (particularly for user button assignments), it would be much more elegant if there was a method I could use for the macro to get its own name/ID on the fly...
evanevery
 
Posts: 20
Joined: Tue Jan 11, 2022 3:57 pm

Re: Retrieve current Macro Name?

Postby cncdrive » Wed Oct 16, 2024 10:59 pm

Try the this.macronumber variable.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: Retrieve current Macro Name?

Postby sebba » Wed Oct 23, 2024 7:58 am

Hello,
Unfortunately is not working

[CS1061 | in line: 11 | error text: 'Macroclass' does not contain a definition for 'macronumber' and no extension method 'macronumber' accepting a first argument of type 'Macroclass' could be found (are you missing a using directive or an assembly reference?)
- YQWQ
User avatar
sebba
 
Posts: 53
Joined: Mon Dec 21, 2020 9:56 am
Location: Bucharest, ROMANIA


Return to Macros

Who is online

Users browsing this forum: No registered users and 2 guests