Page 1 of 1

Retrieve active profile file name?

PostPosted: Sun Sep 08, 2024 1:30 am
by evanevery
Anyone know how to retrieve the full pathname of the currently active profile file from a macro?

I'ld like to be able to share/update some settings from within a private section in the profile with an external executable...

Re: Retrieve active profile file name?

PostPosted: Wed Oct 16, 2024 10:54 pm
by cncdrive
You could use the exec.macroprofilename; variable, but it only gives the name of the profile.
You could also use the Application.StartupPath.ToString(); to get the path of the UCCNC, so you could edit them together.

Re: Retrieve active profile file name?

PostPosted: Thu Oct 17, 2024 1:40 pm
by evanevery
So I tried a very simple macro:

Code: Select all
MessageBox.Show("Macro ID: " + this.macronumber);

MessageBox.Show("Profile Name: " + exec.macroprofilename);

MessageBox.Show("UCCNC Path: " + Application.StartupPath.ToString());


and I get this error:

Code: Select all
UCCNC macro compiler error log file
--------------------------------------
Last error dated: 10/17/2024 8:35:12 AM
In macro: M2000
--------------------------------------
CS1061 | in line: 10 | 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?)
CS1061 | in line: 12 | error text: 'UCCNC.Executer' does not contain a definition for 'macroprofilename' and no extension method 'macroprofilename' accepting a first argument of type 'UCCNC.Executer' could be found (are you missing a using directive or an assembly reference?)
--------------------------------------


So, the "Application.StartupPath.ToString()" works - but the "this.macronumber" and "exec.macroprofilename" does not. (I tried them both as a function (appending "()") and as a variable (as shown))

Am I missing something?