Get other running processes window sizes in Python

后端 未结 4 586
滥情空心
滥情空心 2020-11-30 04:40

This isn\'t as malicious as it sounds, I want to get the current size of their windows, not look at what is in them. The purpose is to figure out that if every other window

4条回答
  •  -上瘾入骨i
    2020-11-30 04:52

    I'm a big fan of AutoIt. They have a COM version which allows you to use most of their functions from Python.

    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
    

提交回复
热议问题