Jump to content
Sign in to follow this  

WinList issue

Recommended Posts

I'm totally new here and I'm stuck with something that should be simple.

I want to know how many Notepad windows I have opened, so I use this code:

$aTables = WinList("Notepad")
MsgBox(4096, "Opened Notepad", $aTables)

but my message box is always empty.

Did I make something wrong or misunderstood the WinList command?

Share this post

Link to post
Share on other sites

Ok thanks, now my message box is not empty anymore but says 1 when no windows is opened and 2 when one notepad is opened. Tried with other windows and same issue.

Share this post

Link to post
Share on other sites


You need to read the helpfile more carefully. And JohnOne suggestion will work if you put a "-1" after the UBound function, as Winlist return an array as state in the helpfile.

Local $aTables = WinList("Notepad")
If IsArray($aTables) Then MsgBox(4096, "Opened Notepad", $aTables[0][0])


Return Value
Returns an array of matching window titles and handles.

If no title and text is given then all top-level windows are returned.

The array returned is two-dimensional and is made up as follows:
$aArray[0][0] = Number of windows returned

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...