JohnTWI Posted November 17, 2020 Posted November 17, 2020 I have one widow open and then another info window is displayed ( unwanted and no Title assigned). I need to close only the info window and continue processing. Both have the small class #32770 If WinExists ("[CLASS:#32770]","") Then ;;;;;;;;;;;;;;;;;;;;;;;;;; Close the Open Dialog Window Sleep(1000) ControlFocus("[CLASS:#32770]", "", "Button1") Sleep(1000) ControlSend("[CLASS:#32770]", "", "Button1", "{ENTER}") Sleep(2000) EndIf
Moderators JLogan3o13 Posted November 17, 2020 Moderators Posted November 17, 2020 (edited) Moved to the appropriate forum, as the Developer General Discussion forum very clearly states: Quote General development and scripting discussions. Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums. Moderation Team Edited November 17, 2020 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
GokAy Posted November 18, 2020 Posted November 18, 2020 (edited) Hey John, You didn't ask a question. Anyway, I believe WinExists would return on the first instance and I don't know if that would be the window you want. I would try something like this, if there is an issue, others would correct it. Maybe, get a list of Windows for the class with WinList function, and check for Title element. test() Func test() Local $aWindowList = WinList("[CLASS:#32770]") if $aWindowList = "" then exit ; No window found For $i = 1 to Ubound($aWindowList)-1 If $aWindowList[$i][0] = "" Then WinClose($aWindowList[$i][1]) ExitLoop EndIf Next EndFunc Edited November 18, 2020 by GokAy Added check for array
JohnTWI Posted November 18, 2020 Author Posted November 18, 2020 Thank you for the feed back. I ran the following below, and there are a lot of windows with no title. Is there a way to get a handle on a newly opened window and close only it? Example() Func Example() ; Retrieve a list of window handles. Local $aList = WinList() MsgBox($MB_SYSTEMMODAL, "stop", "winlist title " & $aList ) ; Loop through the array displaying only visable windows with a title. For $i = 1 To $aList[0][0] If $aList[$i][0] <> "THRIVE PRODUCTION SERVER - Thrive" Then ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; changed to = from <> before the And MsgBox($MB_SYSTEMMODAL, "", "Title: " & $aList[$i][0] & @CRLF & "Handle: " & $aList[$i][1]) EndIf Next EndFunc ;==>Example
GokAy Posted November 18, 2020 Posted November 18, 2020 Maybe you can use these functions to pinpoint the one you are looking for? https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_GetParent.htm https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_EnumChildWindows.htm
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