pywinauto batch file running error <p>Im a biologist and new to pywinauto, i wrote a code to open an input file in HYPHY application using pywinauto, when i run my code line by line in command line it works fine but when i run the code as a batch file it gives the following error.</p> <pre><code>Traceback (most recent call last): File "C:\Users\Masyh\Desktop\autowin_test.py", line 8, in &lt;module&gt; w_handle = pywinauto.findwindows.find_windows(title=u' Please select a batch file to run:', class_name='#32770')[0] IndexError: list index out of range </code></pre> <p>the code is:</p> <pre><code>import pywinauto pwa_app = pywinauto.application.Application() w_handle = pywinauto.findwindows.find_windows(title=u'HYPHY Console', class_name='HYPHY')[0] window = pwa_app.window_(handle=w_handle) window.SetFocus() window.MenuItem(u'&amp;File-&gt;&amp;Open-&gt;Open &amp;Batch File\tCtrl+O').Click() w_handle = pywinauto.findwindows.find_windows(title=u' Please select a batch file to run:', class_name='#32770')[0] window = pwa_app.window_(handle=w_handle) window.SetFocus() ctrl = window['Edit'] ctrl.Click() ctrl.TypeKeys('brown.nuc') ctrl=window['&amp;open'] ctrl.Click() </code></pre> <p>i guess the problem is that the window which gets the input(#'please select a batch file menue') is not open at the beginning and the first part of the code opens it but python looks for it from the beginning and cant find it. i really appreciate any suggestions how to solve this.</p>