Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

F10 is the only interrupt command that I'm aware of. It will pause your script, but then there's no good way to get back into PSSE without resuming it or killing the process. If that doesn't satisfy you, I'd suggest running your script from outside PSSE and opening PSSE from your script. I run most of mine from Sublime Text 2, and I can interrupt them at any time.

click to hide/show revision 2
example code.

F10 is the only interrupt command that I'm aware of. It will pause your script, but then there's no good way to get back into PSSE without resuming it or killing the process. If that doesn't satisfy you, I'd suggest running your script from outside PSSE and opening PSSE from your script. I run most of mine from Sublime Text 2, and I can interrupt them at any time.

(edit) Here is how you could check if a key has been pressed if you ran you Python scripts outside of PSSE:

import time
import msvcrt

while 1:
    print "Doing some hard work (q to quit)"
    time.sleep(2)

    if msvcrt.kbhit():
        key = msvcrt.getch()

        # exit if the user presses "q"
        if key.lower() == 'q':
            break
        else:
            print "%s key pressed" % key

It's using the msvcrt module which comes with Python on Windows. The output would look something like this

Doing some hard work (q to quit)
Doing some hard work (q to quit)
w key pressed
Doing some hard work (q to quit)

For someone that typed w and then later the q key to quit. Here are the official docs for that module: http://docs.python.org/2/library/msvcrt.html#console-i-o

I'm using kbhit to check if a key was pressed. Then getch to get the key and comparing it to q.