Make your program USE a gui

前端 未结 5 1909
我寻月下人不归
我寻月下人不归 2021-01-03 10:56

I\'d like to write a program able to \"use\" other programs by taking control of the mouse/keyboard and being able to \"see\" what\'s on the screen.

I used AutoIt to

5条回答
  •  半阙折子戏
    2021-01-03 11:12

    AutoIt is completely capable of doing everything you mentioned. When I'm wanting to do some automation but use the features of Python, I find it easiest to use AutoItX which is a DLL/COM control.

    Taken from this answer of mine:

    import win32com.client
    oAutoItX = win32com.client.Dispatch( "AutoItX3.Control" )
    
    oAutoItX.Opt("WinTitleMatchMode", 2) #Match text anywhere in a window title
    
    width = oAutoItX.WinGetClientSizeWidth("Firefox")
    height = oAutoItX.WinGetClientSizeHeight("Firefox")
    
    print width, height
    

提交回复
热议问题