Z
zhouhaifeng
just like "ctrl + A",
I want to select all the text in a window, now , I operate right menu to
get it, but it can not work all the time.
so I want to send "ctrl + a" to the window
blow is my code
thanks
hWnd = win32gui.FindWindow(None, "¡°Öлª»á¼ÆÍøУ¡±²ÆË°·¨¹æ¿âÏÂÔØ°æV1.09-·¨
¹æÔĶÁÆ÷")
print hWnd
if hWnd <> 0:
print "½«½¹µãÒÆÖÁ´°¿ÚÄÚ"
point = (755, 175)
x, y = point
win32api.SetCursorPos(point)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x, y, 0, 0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)
print "ÓÒ¼ü²Ëµ¥"
win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN,x, y, 0, 0)
win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP, x, y, 0, 0)
win32api.Sleep(1000)
#µ¥»÷"È«Ñ¡"
x = x + 10
y = y + 115
point = (x, y)
win32api.SetCursorPos(point)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x, y, 0, 0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)
win32api.Sleep(500)
#ÓÒ¼ü²Ëµ¥
point = (455, 175)
x, y = point
win32api.SetCursorPos(point)
win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN,x, y, 0, 0)
win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP, x, y, 0, 0)
#win32api.SendMessage(hwnd, win32con.WM_KEYDOWN, win32con.VK_CONTROL, 0)
#win32api.SendMessage(hwnd, win32con.WM_KEYUP, win32con.VK_CONTROL, 0)
win32api.Sleep(500)
#µ¥»÷"¸´ÖÆ"
x = x + 10
y = y + 25
point = (x, y)
win32api.SetCursorPos(point)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x, y, 0, 0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)
I want to select all the text in a window, now , I operate right menu to
get it, but it can not work all the time.
so I want to send "ctrl + a" to the window
blow is my code
thanks
hWnd = win32gui.FindWindow(None, "¡°Öлª»á¼ÆÍøУ¡±²ÆË°·¨¹æ¿âÏÂÔØ°æV1.09-·¨
¹æÔĶÁÆ÷")
print hWnd
if hWnd <> 0:
print "½«½¹µãÒÆÖÁ´°¿ÚÄÚ"
point = (755, 175)
x, y = point
win32api.SetCursorPos(point)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x, y, 0, 0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)
print "ÓÒ¼ü²Ëµ¥"
win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN,x, y, 0, 0)
win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP, x, y, 0, 0)
win32api.Sleep(1000)
#µ¥»÷"È«Ñ¡"
x = x + 10
y = y + 115
point = (x, y)
win32api.SetCursorPos(point)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x, y, 0, 0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)
win32api.Sleep(500)
#ÓÒ¼ü²Ëµ¥
point = (455, 175)
x, y = point
win32api.SetCursorPos(point)
win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN,x, y, 0, 0)
win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP, x, y, 0, 0)
#win32api.SendMessage(hwnd, win32con.WM_KEYDOWN, win32con.VK_CONTROL, 0)
#win32api.SendMessage(hwnd, win32con.WM_KEYUP, win32con.VK_CONTROL, 0)
win32api.Sleep(500)
#µ¥»÷"¸´ÖÆ"
x = x + 10
y = y + 25
point = (x, y)
win32api.SetCursorPos(point)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x, y, 0, 0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)