time.sleep(.1) winsound.Beep(440, 500) # if no points were selected, then exit the app if len(points) == 0: print "No coordinates selected. Exiting..." exit() print "Mouse coordinates collected. Charts will be updated every 30 minutes." hwnd = win32gui.WindowFromPoint(points[0]) # 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 point = points[0] hwnd = win32gui.WindowFromPoint(point) pt = win32gui.ScreenToClient(hwnd, point) hw = pywinauto.controls.HwndWrapper.HwndWrapper(hwnd) #hw.Click(button='right', coords = pt) #app.PopupMenu.MenuItem("Split All").Click() # first time through we run the code to ensure all charts start off split firstTime = True while True: dt = datetime.now() # execute this code at the top and bottom of every hour (xx:00 and xx:30) if firstTime == True or dt.minute == 0 or dt.minute == 30:
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}")
pywinauto.mouse.move(coords=(0, 0)) Move the mouse pywinauto.mouse.press(button='left', coords=(0, 0)) Press the mouse button pywinauto.mouse.release(button='left', coords=(0, 0)) Release the mouse button pywinauto.mouse.right_click(coords=(0, 0)) Right click at the specified coords pywinauto.mouse.scroll(coords=(0, 0), wheel_dist=1) Do mouse wheel pywinauto.mouse.wheel_click(coords=(0, 0)) Middle mouse button click at the specified coords """ import pywinauto.application app = pywinauto.application.Application() comapp = app.connect_(path="explorer") for i in comapp.windows_(): if "Progman" == i.FriendlyClassName(): i.ClickInput(coords=(900, 50)) import win32api x, y = win32api.GetCursorPos()
time.sleep(.1) #print point hwnd = win32gui.WindowFromPoint(point) #print hwnd pt = win32gui.ScreenToClient(hwnd, point) hw = pywinauto.controls.HwndWrapper.HwndWrapper(hwnd) #print hw.MenuItems() rowCount = 30 # connect to Excel xlapp = Application() 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~")