How to pass arguments to tcl script on Hyperworks start

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hi,
I have a tcl script and the tcl is using Hyperworks(Hyperview) library, so I must run it with Hyperview.
I check the help doc and found the following command to load tcl:

 <altair_home>/hw/bin/<platform>/hw.exe -clientconfig hwpost.dat -tcl example.tcl

But I cannot pass an argument to the tcl.
For example, I can run this tcl using:

 tclsh example.tcl arg1 arg2 ...

The arguments arg1, arg2 will be passed to tcl script, Can I do this using hw.exe -tcl command?

Thanks!

Answers

  • tinh
    tinh Altair Community Member
    edited January 2016

    Hi

    you can do it normally

    hw.exe -clientconfig hwpost.dat -tcl example.tcl arg1 arg2

     

    you will scan these args right after 'example.tcl', so

    set arglist [lrange $args [lsearch -exact $args 'example.tcl'] end]

    lassign $arglist TclFileName arg1 arg2