ngels Posted June 1, 2016 Share Posted June 1, 2016 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? Link to comment Share on other sites More sharing options...
JohnOne Posted June 1, 2016 Share Posted June 1, 2016 $aTables = WinList("Notepad") MsgBox(4096, "Opened Notepad", UBound($aTables)) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
ngels Posted June 1, 2016 Author Share Posted June 1, 2016 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. Link to comment Share on other sites More sharing options...
MichaelHB Posted June 1, 2016 Share Posted June 1, 2016 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 Link to comment Share on other sites More sharing options...
ngels Posted June 1, 2016 Author Share Posted June 1, 2016 ok thank you for your help. Link to comment Share on other sites More sharing options...
JohnOne Posted June 3, 2016 Share Posted June 3, 2016 Sorry $aTables = WinList("Notepad") MsgBox(4096, "Opened Notepad", UBound($aTables) -1) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now