Hello, I need to run a particular graphics application over and over again with a different command line to get benchmarks on the applications performance (frame rates and similar data). I am running the following within a while loop that parses out a different command line from a configuration file.
############ def runCommand(command): """runCommand(command) Parameters: command -- the full string of the command to execute """ print command try: childProcess = subprocess.Popen(command) done = False while not done: returnCode = childProcess.poll() if (returnCode != None): done = True else: # sleep for 10 seconds before checking again time.sleep(10) except KeyboardInterrupt: print 'KeyboardInterrupt received. Trying to kill Wolf2.exe' print '>TASKKILL /F /T /PID ', childProcess.pid killCommand = ''.join(('TASKKILL /F /T /PID ', str(childProcess.pid))) killSubProcess = subprocess.Popen(killCommand) killSubProcess.wait() sys.exit(0) except OSError, (errno, strerror): print 'OS Error (%s): %s' % (errno, strerror) print 'Above error occurred while executing the following:' print command except WindowsError, (errno, strerror): print 'MS Windows Error (%s): %s' % (errno, strerror) print 'Above error occurred while executing the following:' print command ########## The problem lies in that the second time the application is run, it doesn't grab focus and go full screen, but sits paused. It will not continue running until I click on the minimized application in the taskbar. Is there any way to force it to grab focus? I am running on Win32 with Python 2.5.1. Your help in this matter is greatly appreciated, Mick Charles Beaver -- http://mail.python.org/mailman/listinfo/python-list