Sign in to follow this  
Followers 0
trunc.ate

List of currently active windows

6 posts in this topic

Is it possible to get a list of all currently active windows?

I want to launch a program by script and to concentrate on that window I want to hide all other windows with the @SW_HIDE macro. When I close the new program I'd like to restore the other windows (@SW_RESTORE) as if nothing happend.

Seems that everything I need is there but I'll need the window titles, therefore my question.

Share this post


Link to post
Share on other sites



.. to concentrate on that window I want to hide all other windows ..

If your goal is simply to ensure that your interaction all goes to a specific window, then have a look at the ControlSend function (and other Control* functions) .. which doesn't require you to hide any of the other windows. See helpfile for details :D

Share this post


Link to post
Share on other sites

Thanks, but it's not ensuring the interaction to a specific window, it's really about me :D who gets easily distracted by other windows.

So the goal is not functionality but beauty :huh2: I just want that specific window on my desktop and all the others hidden.

Share this post


Link to post
Share on other sites

w00t!

That's even better, works like a charm. Thanks! :D

Share this post


Link to post
Share on other sites

Hi all,

i'm looking for the same functionality as trunc.ate and not a workaround like WinMinimizeAll()

is there a way to get an array of all open windows names?

thnxs...

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I am wanting the ability to look through all the active windows and locate all instances of a specific program, then at regular send a keystroke to each instance of that program, preferably with the minimum of disturbance to the computer's operation. The program I am wanting to find all instances of has instances all with the same name and no secondary text to distinguish between the instances.

My thinking is as follows:

The ALT ESC keystoke will switch from one window to the next.

$DesiredProgramTitle = "SomeProgame"

$NextHandle = "ImpossibleHandle"

Send( "!{ESC}" ); switches to the next window
Sleep(5000)

Opt( "WinTitleMatchMode", 4); enables you to use  "active" in WinGetHandle

$FirstHandle = WinGetHandle( "active"); gets the handle of the current window

Dim $HandleArray[100]; for holding the handles of the desired program's instances
$I = 0 


While $NextHandle <> $FirstHandle
         If WinGetTitle("")  = $DesiredProgramTitle Then
            $HandleArray[$I] = WinGetHandle("active")
            $I = $I + 1
         Endif
         Send( "!{ESC}" ); switches to the next window
         Sleep(2000); give some time to react
         $NextHandle = WinGetHandle("active")
WEnd

$maxI = $I - 1

$J = 0 
While 1 
    
    ControlSend("handle=" & $HandleArray[$J], "", "", "{LEFT}{RIGHT}")
    $J = $J + 1 
    If $J > $maxI Then
       $J = 0 
    Endif
WEnd

I am thinking this will give me an array of the handles of all the instances of the desired program and then I would send the keystrokes to the windows in the background with ControlSend.

I am just starting on AutoIt. Am I making any sense?

Edited by ChuckSB

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  
Followers 0