Jump to content

Recommended Posts

Posted

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?

Posted

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.

Posted

ngels,

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])

Exit

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

Remarks
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

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
  • Recently Browsing   0 members

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