How to reference the Preference file location

Ryan O'Sullivan
Ryan O'Sullivan Altair Community Member
edited March 2021 in Community Q&A

I'm attempting to create a custom toolbar menu that will hold some scripts. All of this will be stored in git, and users will be able to clone their repository anywhere they please.

Therefore, I cannot include any fully-defined paths to .tcl scripts: everything needs to be relative. Is something like this possible?

 

For example:

 

*Id("HyperWorks", "20.*") *BeginDefaults()     *BeginGraphicDefaults()         *BeginMenu(base, Tools)             *BeginMenu(results, Post Processing)                 *MenuItem(results, This Script, TCL, "../my_scripts/this_script.tcl")             *EndMenu()       *EndMenu()      *EndGraphicDefaults()  *EndDefaults()

Best Answer

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited March 2021 Answer ✓

    Try this method: define your env variable for your TCL path:

    TCL_INCLUDE=C:/path1;C:/path2

    And within your script use only filename, for example "this_script.tcl"

     

     

Answers

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited March 2021

    This method should work. Do you test it?

  • Ryan O'Sullivan
    Ryan O'Sullivan Altair Community Member
    edited March 2021

    Yes I have given it a try. It returns:

     

    No such file: ../my_scripts/this_script.tcl  

     

    I have also tried it by placing `this_script.tcl` within the same directory as my preferences file and using `./this_script.tcl` and didn't have any luck with that either.

     

    I am surprised it didn't work.

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited March 2021 Answer ✓

    Try this method: define your env variable for your TCL path:

    TCL_INCLUDE=C:/path1;C:/path2

    And within your script use only filename, for example "this_script.tcl"

     

     

  • Ryan O'Sullivan
    Ryan O'Sullivan Altair Community Member
    edited March 2021

    Thanks Q, that did work. It's unfortunate that the relative path resolving didn't as that's such a common standard...