Jump to content
Sign in to follow this  
mocambique

Loopy about Windows

Recommended Posts

mocambique

How can I get Autoit to show me a list of all active window titles?

Would it be a combination of WinExists and a loop?

I have a program that opens multiple windows and I would like Autoit to show me which windows are open (by title) and then the user can activate a window that may be hidden behind another.

Share this post


Link to post
Share on other sites
mocambique

Thanks. It works quite well.

My final script goes something like this:

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

$mainwindow = GUICreate("Activate", 179.25, 245.25)

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

GUICtrlCreateLabel("Select window to" & @LF & "activate.", 1, 1)

$okbutton = GUICtrlCreateButton("Activate",100 , 1, 60)

GUICtrlSetOnEvent($okbutton, "OKButton")

$mylist = GuiCtrlCreateList("", 1, 26, 170, 200)

$var = WinList()

For $i = 1 to $var[0][0]

If $var[$i][0] <> "" AND IsVisible($var[$i][1]) and $var[$i][0] <> "Activate" Then

GUICtrlSetData($mylist,$var[$i][0])

EndIf

Next

GUISetState(@SW_SHOW)

While 1

Sleep(1000) ; Idle around

WEnd

Func OKButton()

WinActivate(GUICtrlRead($mylist)) ;activate selected window

Exit ;end program

EndFunc

Func CLOSEClicked()

Exit ;end program

EndFunc

Func IsVisible($handle)

;checks if window is a visible window

If BitAnd( WinGetState($handle), 2 ) Then

Return 1

Else

Return 0

EndIf

EndFunc

Check the helpfile for WinList()

:P

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×