picea892 Posted March 3, 2009 Posted March 3, 2009 I think this may have a short answer but can't seem to land on it. How to you get the current window's class? WinGetClassList doesn't work. What I want to do, is get the class of the active window and then close all windows of that class. The below works, but I think is sloppy, there has to be a better way. Thanks in advance for help with this simple question. func closegroup() If WinActive("[CLASS:ExploreWClass]") Then $classed="[CLASS:ExploreWClass]" If WinActive("[CLASS:CabinetWClass]") Then $classed="[CLASS:CabinetWClass]" If WinActive("[CLASS:AcrobatSDIWindow]") Then $classed="[CLASS:AcrobatSDIWindow]" If WinActive("[CLASS:IEFrame]") Then $classed="[CLASS:IEFrame]" If WinActive("[CLASS:XLMAIN]") Then $classed="[CLASS:XLMAIN]" local $var = WinList($classed) For $i = 0 to $var[0][0] WinClose($classed, "") sleep(400) Next EndFunc This could end up being a really long list and even then you will miss some.
Robjong Posted March 3, 2009 Posted March 3, 2009 (edited) #Include <WinAPI.au3> $text = _WinAPI_GetClassName(WinGetHandle("[ACTIVE]")) ConsoleWrite($text & @CRLF) Edit: oops, now i get it Edited March 3, 2009 by Robjong
Josbe Posted March 3, 2009 Posted March 3, 2009 I think this may have a short answer but can't seem to land on it. How to you get the current window's class? WinGetClassList doesn't work. What I want to do, is get the class of the active window and then close all windows of that class. The below works, but I think is sloppy, there has to be a better way. Thanks in advance for help with this simple question. func closegroup() If WinActive("[CLASS:ExploreWClass]") Then $classed="[CLASS:ExploreWClass]" If WinActive("[CLASS:CabinetWClass]") Then $classed="[CLASS:CabinetWClass]" If WinActive("[CLASS:AcrobatSDIWindow]") Then $classed="[CLASS:AcrobatSDIWindow]" If WinActive("[CLASS:IEFrame]") Then $classed="[CLASS:IEFrame]" If WinActive("[CLASS:XLMAIN]") Then $classed="[CLASS:XLMAIN]" local $var = WinList($classed) For $i = 0 to $var[0][0] WinClose($classed, "") sleep(400) Next EndFunc This could end up being a really long list and even then you will miss some.Another way could be: #include <WinAPI.au3> $hwnd= WinGetHandle("[active]") MsgBox(4096, "Get ClassName", "ClassName of " & $hwnd & ": " & _WinAPI_GetClassName($hwnd)) AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta
picea892 Posted March 3, 2009 Author Posted March 3, 2009 Thanks for the fast replies! I knew there was a simple solution but couldn't find it. The below is my final script func closegroup() $hwnd= WinGetHandle("[active]") $classed = _WinAPI_GetClassName($hwnd) local $var = WinList("[CLASS:"&$classed&"]") For $i = 0 to $var[0][0] WinClose("[CLASS:"&$classed&"]", "") sleep(400) Next EndFunc
PPCC Posted February 6, 2012 Posted February 6, 2012 Sorry I make comment here late. Just tell who haven't known.I've just known the available tool to define class of windows, button and other properties. It's Au3Info, default as "C:Program FilesAutoIt3Au3Info.exe"Drag and drop Finder Tool into object we need to know, we will have the answer.
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