ngels Posted June 1, 2016 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?
JohnOne Posted June 1, 2016 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.
ngels Posted June 1, 2016 Author 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.
MichaelHB Posted June 1, 2016 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
JohnOne Posted June 3, 2016 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.
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