1
我使用Python 3.4.1通過win32com.client控制Windows應用程序。我可以激活它,我可以發送擊鍵,點擊等。 現在我想知道是否有一種方法來調整窗口大小並將其設置爲特定位置。我找不到這樣的方法。 這裏的一些代碼片段,讓你知道我在說什麼python win32com.client調整窗口
import win32api, win32con, time, win32com.client, random, sys, winsound, datetime
...
def click_mouse(x,y, p_wait=0.1):
win32api.SetCursorPos((x,y))
time.sleep(p_wait)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
def move_mouse(x,y):
win32api.SetCursorPos((x,y))
time.sleep(0.5)
def activate():
global shell
shell=win32com.client.Dispatch("Wscript.Shell")
success = shell.AppActivate("App")
def resize():
global shell
???