robotgo
robotgo copied to clipboard
How to operate a window,move window
How to operate a window
obtain a window handle, and move the window
find follow function,not found how to move window
mdata := robotgo.GetActive()//获取当前窗口
hwnd := robotgo.GetHandle()//获取当前窗口hwnd
Println("hwnd---", hwnd)
title := robotgo.GetTitle()//获取当前窗口标题
Println("title-----", title)
robotgo.CloseWindow()//关闭当前窗口
robotgo.SetActive(mdata)//SetActive窗口
Can refer to PyAutoGUI Window handling features:
pyautogui.getWindows() # returns a dict of window titles mapped to window IDs pyautogui.getWindow(str_title_or_int_id) # returns a “Win” object win.move(x, y) win.resize(width, height) win.maximize() win.minimize() win.restore() win.close() win.position() # returns (x, y) of top-left corner win.moveRel(x=0, y=0) # moves relative to the x, y of top-left corner of the window win.clickRel(x=0, y=0, clicks=1, interval=0.0, button=’left’) # click relative to the x, y of top-left corner of the window Additions to screenshot functionality so that it can capture specific windows instead of full
robotgo example code is good, for basic Window handling