How to determine user's software version by TCL

James Seedorf
James Seedorf Altair Community Member
edited August 2021 in Community Q&A

Across our team some people use Hypermesh/Hyperworks Desktop and some use plain HyperMesh, one of our .TCL scripts need to vary depending on which software is being used.  I can't seem to find any queries that return a useful difference I could compare against.

 

Answers

  • Adriano A. Koga
    Adriano A. Koga
    Altair Employee
    edited July 2021

    HW or HWDesktop has a bigger list of APIs supported such as the 'hwi' class.

    So if you run 'hwi ListMethods' in HWDesktop, you will get this as return.

    Not the fancier way, but you could use this to identify if it is HMDesktop or Standalone HM.

     

    HWDesktop

    image

    HM doesn't have this.

    image

  • James Seedorf
    James Seedorf Altair Community Member
    edited July 2021

    HW or HWDesktop has a bigger list of APIs supported such as the 'hwi' class.

    So if you run 'hwi ListMethods' in HWDesktop, you will get this as return.

    Not the fancier way, but you could use this to identify if it is HMDesktop or Standalone HM.

     

    HWDesktop

    image

    HM doesn't have this.

    image

    Thanks, this is what I ended up doing.  I had to use Catch to catch the error that comes up if you try to run a desktop command in hypermesh and I could then create my if statement based on that catch. I'm not a huge fan of causing errors on purpose in these tools, but it works.

  • tdepa
    tdepa Altair Community Member
    edited August 2021

    How about something like this? We do this once then check the variable for the rest of the scripts run in the session.

    if { [info command hwi] == "hwi" } {
        puts "Running in HyperWorks Desktop."
        set hwDesktop true
    }