Closing a program

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

Hey guys,

 

I'm looking for a .tcl-command to completely close a program. The program starts with a messagebox where you can choose yes or no. If you select yes, the program runs as it is planned.

If you choose no, the whole program should stop. There for I used the exit 2 command.

But instead of closing the whole program it only closes the message box and tries to run the code afterwards.

Do you have an idea how to fix that problem?

 

This is the relevant part of the code:

set starting [tk_messageBox -message 'Möchten Sie eine vorhandenes Modell verwenden?' -type yesno -icon question -title 'Einladen des Modells']
switch -- $starting {
yes {
set basedir {C:/}
set filetypes {{{Text} {*.fem}} {{Alle} {*}}}

set par [tk_getOpenFile \
        -initialdir [pwd]\
        -title 'Startdatei wählen...'\
        -filetypes $filetypes
        ]
    *feinputwithdata2 '\#optistruct\\optistruct' '$par' 0 0 0 0 0 1 9 1 0
    }
    no {
        exit 2
        }
    }

*createentity mats cardimage=MAT1 name=material1

...

 

Kind regards,

Simon

Answers

  • tinh
    tinh Altair Community Member
    edited January 2019

    Hi

    'exit' is to close hypermesh.

    Use 'return' instead, to cancel a script