from pywinauto import Application app = Application() app.connect_(title_re="Autotrader") dlg = app.Autotrader.AfxFrameOrView100 notepad = Application() notepad.connect_(title_re=".*Notepad$") notedlg = notepad.top_window_() # move to the upper-left cell of the grid dlg.TypeKeys("{LEFT 50}{UP 50}") #dlg.TypeKeys("{DOWN}") for row in range(7): notedlg.TypeKeys("{= 40}{ENTER}") for column in range(31): dlg.TypeKeys("^c") notedlg.TypeKeys("^v{ENTER}") dlg.TypeKeys("{RIGHT}") dlg.TypeKeys("{DOWN}") dlg.TypeKeys("{LEFT 31}") notedlg.TypeKeys("{= 40}{ENTER}")
xlapp.connect_(title_re=".*Microsoft Excel") # create the XStudy application using a window handle app = Application() app.connect_(handle=hwnd) # pass the window handle of one of the app's window # play a short sound for each value retrieved winsound.Beep(880, 200) # right-click on the indicator hw.Click(button='right', coords=pt) # current value #hw.TypeKeys('l~c', pause=0.5) app.PopupMenu.MenuItem("Link To Excel->Current Value").Click() xlapp.top_window_().TypeKeys("^v~") print "1/" + str(rowCount) # grab rows (user can discard data if 30 is too much) for i in range(1, rowCount): # play short sound for each value retrieved winsound.Beep(880, 200) # right-click on the indicator hw.Click(button='right', coords=pt) # previous value #hw.TypeKeys('l~p', pause=0.5) app.PopupMenu.MenuItem("Link To Excel->Previous Value").Click()