Jump to content

Get all window names in an array


Recommended Posts

Hi,

I want to have an array with all the names of the windows that are currently opened (i.e. visible in the taskbar).

I've found the following code in the Help file,

$oShell = ObjCreate("shell.application")
$oShellWindows=$oShell.windows

if Isobj($oShellWindows) then
  $string=""

  for $Window in $oShellWindows
    $String = $String & $window.LocationName & @CRLF
  next

  msgbox(0,"","You have the following windows open:" & @CRLF & $String)
else

  msgbox(0,"","you have no open shell windows.")
endif

but that only lists the shell windows - I want all the windows.

Is that possible?

Link to comment
Share on other sites

WinList()

:)

The problem is that WinList() gives me loads and loads of windows, not just the ones in the taskbar...

I want to e.g. open the windows one after the other, and setting the property of windows like "Hidden Fax Window" to @SW_MAXIMIZE is not a good idea...

How can I get just the taskbar windows?

Link to comment
Share on other sites

The problem is that WinList() gives me loads and loads of windows, not just the ones in the taskbar...

I want to e.g. open the windows one after the other, and setting the property of windows like "Hidden Fax Window" to @SW_MAXIMIZE is not a good idea...

How can I get just the taskbar windows?

#include <Array.au3>

$avWinList = WinList()
For $n = $avWinList[0][0] To 1 Step -1
; Visible windows with valid titles (not the desktop) only
    If (BitAND(WinGetState($avWinList[$n][1]), 0x2) = False) Or ($avWinList[$n][0] = "") Or _
        ($avWinList[$n][0] = "Program Manager") Then _ArrayDelete($avWinList, $n)
Next
$avWinList[0][0] = UBound($avWinList) - 1
_ArrayDisplay($avWinList)

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

#include <Array.au3>

$avWinList = WinList()
For $n = $avWinList[0][0] To 1 Step -1
; Visible windows with valid titles (not the desktop) only
    If (BitAND(WinGetState($avWinList[$n][1]), 0x2) = False) Or ($avWinList[$n][0] = "") Or _
        ($avWinList[$n][0] = "Program Manager") Then _ArrayDelete($avWinList, $n)
Next
$avWinList[0][0] = UBound($avWinList) - 1
_ArrayDisplay($avWinList)

:)

Great... I get the following error message:

C:\Program Files\AutoIt3\Include\array.au3 (139) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

$avNewArray[$iCntr] = $avArray[$iCntr]

$avNewArray[$iCntr] = ^ ERROR

There seems to be something wrong about the _ArrayDelete call.

Is there a possibility that _ArrayDelete only works with one-dimensional arrays?

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...