Adding buttons to the Utility Menu without administrator access
The post here explains that in order to add buttons to the utility menu, files in the Program Files directory need to be changed. However, I have to request special access from our IT department to get the administrator privileges required to modify files in the Program Files directory. This would make changing the utility menu extremely inconvenient. Is there a way that I can tell HyperMesh to reference a file in the default working directory for creating the utility menu?
Answers
-
userpage.mac is valid if saved in Start-in directory or HW_CONFIG_PATH environment variable:-)
Thanks,
Imoto
0 -
Altair Forum User said:
The post here explains that in order to add buttons to the utility menu, files in the Program Files directory need to be changed. However, I have to request special access from our IT department to get the administrator privileges required to modify files in the Program Files directory. This would make changing the utility menu extremely inconvenient. Is there a way that I can tell HyperMesh to reference a file in the default working directory for creating the utility menu?
Hi,
No need to keep tcl files in Program files everytime, you can keep it in some personal location and mention full path while creating button.
*createbutton(5,'SaveFile TCL',15,0,10,GREEN,'Save file using TCL macro', 'EvalTcl','E:\vipin\savefile.tcl')
Then keep userpage.mac in hypermesh working directory(by default My Documents).
0 -
I have the following code saved in 'userpage.mac' in my working directory:
// HWVERSION_2017.2_Jul 25 2017_20:5:5 /////////////////////////////////////////////////////////////////////////////// // Filename: userpage.mac // Purpose: Macro menu 'User' page definitions. // Version: HyperWorks // Altair Copyright: /////////////////////////////////////////////////////////////////////////////// //User Page Widget Definitions // //Note: Since relative row locations are used, the menu page is built from // the bottom up. // //The following templex test is used to see if the Tcl support buttons // should be added. //{ if ( getenv('HM_DEBUG') == 'ON' ) } *createbutton(5, 'TkCon ...', -1, 0, 10, BUTTON, 'Launch the Tk Console.', EvalTcl, 'tkcon.tcl') *createbutton(5, 'GUI Toolkit ...', -1, 0, 10, BUTTON, 'Launch the GUI Toolkit.', LaunchWidgetTour) *createbutton(5, 'ProDebug', 0, 0, 10, BUTTON, 'Connect to the TclPro debugger.', ConnectToDebugger) *createbutton(3, 'Add Washer', 0, 0, 10, BUTTON, 'Adds a washer to the existing hole in the mesh.', 'EvalTcl', 'macroAddWasher.tcl') *createbutton(5,'SaveFile TCL',15,0,10,GREEN,'Save file using TCL macro', 'EvalTcl','E:\vipin\savefile.tcl') //{ endif } //User Page Macro Definitions /////////////////////////////////////////////////////////////////////////////// *beginmacro('ConnectToDebugger') // Purpose:To connect to a remotely running ProDebug session. // // Note: The pathname to the 'prodebug.tcl' script may need to be //modified toreflect your installation of TclPro. *evaltclstring('source /Program\ Files/tclPro1.4/win32-ix86/bin/prodebug.tcl; debugger_init;',0) *endmacro() /////////////////////////////////////////////////////////////////////////////// *beginmacro('LaunchWidgetTour') // Purpose:Launch the HyperWorks Widget Tour dialog. *evaltclstring('::hwt::WidgetTour',1) *endmacro()
However, when I start HyperMesh, this is what I see on the User Page:
The point is that as far as I can tell, HyperMesh is ignoring the userpage.mac file that I have saved in my start-in/working directory. Is there something I'm missing?
0 -
How about HW_CONFIG_PATH environment variable?
0 -
As far as I can tell, I don't have that environment variable set. Here are all the environment variables that I have:
Do I need to set HW_CONFIG_PATH to my working directory? I thought it was sufficient to just set the 'start-in' path on the shortcut used. Furthermore, clearly the working directory is correct when HyperMesh starts, so I'm still not sure why HyperMesh is ignoring my userpage.mac file.
0 -
Move your custom macros under
// User Page Macro Definitions
it will appear.
// HWVERSION_2017.2_Jul 25 2017_20:5:5
///////////////////////////////////////////////////////////////////////////////
// Filename: userpage.mac
// Purpose: Macro menu 'User' page definitions.
// Version: HyperWorks
// Altair Copyright:
///////////////////////////////////////////////////////////////////////////////
// User Page Widget Definitions
//
// Note: Since relative row locations are used, the menu page is built from
// the bottom up.
//// The following templex test is used to see if the Tcl support buttons
// should be added.//{ if ( getenv('HM_DEBUG') == 'ON' ) }
*createbutton(5, 'TkCon ...', -1, 0, 10, BUTTON, 'Launch the Tk Console.', EvalTcl, 'tkcon.tcl')
*createbutton(5, 'GUI Toolkit ...', -1, 0, 10, BUTTON, 'Launch the GUI Toolkit.', LaunchWidgetTour)
*createbutton(5, 'ProDebug', 0, 0, 10, BUTTON, 'Connect to the TclPro debugger.', ConnectToDebugger)//{ endif }
// User Page Macro Definitions
*createbutton(5, 'Add Washer', -1, 0, 10, BUTTON, 'Adds a washer to the existing hole in the mesh.', 'EvalTcl', 'macroAddWasher.tcl')
*createbutton(5,'SaveFile TCL',-1,0,10,GREEN,'Save file using TCL macro', 'EvalTcl','E:\vipin\savefile.tcl')
///////////////////////////////////////////////////////////////////////////////
*beginmacro('ConnectToDebugger')
// Purpose: To connect to a remotely running ProDebug session.
//
// Note: The pathname to the 'prodebug.tcl' script may need to be
// modified to reflect your installation of TclPro.*evaltclstring('source /Program\ Files/tclPro1.4/win32-ix86/bin/prodebug.tcl; debugger_init;',0)
*endmacro()///////////////////////////////////////////////////////////////////////////////
*beginmacro('LaunchWidgetTour')
// Purpose: Launch the HyperWorks Widget Tour dialog.*evaltclstring('::hwt::WidgetTour',1)
*endmacro()0 -
It's working fine with Start-in directory in my PC and my colleag's PC.
I tested with attached userpage.mac.Thanks,
Imoto0 -
Altair Forum User said:
Move your custom macros under
// User Page Macro Definitions
it will appear.
That seems odd. How does a comment affect the functionality of the code?
Altair Forum User said:It's working fine with Start-in directory in my PC and my colleag's PC.
I tested with attached userpage.mac.That works as well. This seems very confusing. Why does this file work, but the one I was using previously didn't?
0 -
It's because you put your code within this condition
so if hm is not running in debug mode, you will not see your button
//{ if ( getenv('HM_DEBUG') == 'ON' ) }
0 -
Altair Forum User said:
It's because you put your code within this condition
so if hm is not running in debug mode, you will not see your button
//{ if ( getenv('HM_DEBUG') == 'ON' ) }
Doesn't the double slash at the beginning of that line comment out the condition though? Or am I misunderstanding something about how comments are interpreted?
0 -
Altair Forum User said:
Doesn't the double slash at the beginning of that line comment out the condition though? Or am I misunderstanding something about how comments are interpreted?
Are you working with TCL language? If yes, the comment line should begin with #
0 -
Altair Forum User said:
Are you working with TCL language? If yes, the comment line should begin with #
I am working with whatever language is used for the .mac files in HyperMesh. It's not exactly clear to me what language it is, but I do know it's not TCL (which uses the extension .tcl for its files). The code I was originally using came directly from the program files directory. Here is the path on my system: C:\Program Files\Altair\2017\hm\bin\win64\userpage.mac. It seemed quite clear to me that this file is using '//' to comment out lines that should not be executed. Therefore, I tried to comment out the if-statement. However, clearly, I'm missing something since I did not actually comment out the line like I thought I had.
0 -
I think language in *.mac file is neither tcl nor C, just a kind of script that hm will process
// is comment but if it's followed by special directives, hm can process /emoticons/default_wink.png' srcset='/emoticons/wink@2x.png 2x' title=';)' width='20' />
0 -
Altair Forum User said:
I think language in *.mac file is neither tcl nor C, just a kind of script that hm will process
// is comment but if it's followed by special directives, hm can process /emoticons/default_wink.png' srcset='/emoticons/wink@2x.png 2x' title=';)' width='20' />
Wow! That seems like a terrible idea. It seems like that encourages users to never comment their code because it can cause their code to have problems.
0 -
don't worry, the code with '*' will be process as macro command
just the code without * will be able to process as directives
as macro commands have many limits, you should forget it soon and change to use tcl/tk to build GUI and implement
0