Sign in to follow this  
Followers 0
i2i8

How to use AutoIt Script close this window?

7 posts in this topic

#1 ·  Posted (edited)

How to use AU3 close this window when it pops up?

Windows Info:

>>>> Window <<<<
Title:  Microsoft Windows
Class:  #32770
Position:   181, 202
Size:   446, 267
Style:  0x96C80284
ExStyle:    0x00010101
Handle: 0x000302AA

>>>> Control <<<<
Class:  DirectUIHWND
Instance:   1
ClassnameNN:    DirectUIHWND1
Name:   
Advanced (Class):   [CLASS:DirectUIHWND; INSTANCE:1]
ID: 
Text:   
Position:   0, 0
Size:   430, 229
ControlClick Coords:    228, 12
Style:  0x56000000
ExStyle:    0x00000000
Handle: 0x000202AC

>>>> Mouse <<<<
Position:   417, 244
Cursor ID:  0
Color:  0xFFFFFF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Scan and fix (recommended)
Continue without scanning


>>>> Hidden Text <<<<
Edited by i2i8

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hopefully this is what you're looking for;

While 1
If WinExists("") Then
;If ProcessExists("") Then <- Better Solution
   WinClose("") ; Closes the Window based solely on the Window Title
   ;ProcessClose("") ; Closes the Window based on the Windows Process.exe name
   WinWaitClose("") ; Wait until the window is closed
   ;ProcessWaitClose("") ; Wait until the window is closed via Process Close
   MsgBox(0, "", "Window X has been closed", 10)
ElseIf WinExists("") = "0" Then
;ElseIf ProcessExists("") = "0" Then
   MsgBox(0, "", "Hey Jack, That window doesn't exist!", 10)
EndIf
WEnd

Just fill in the blanks

Edited by BlackDawn187

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hello,BlackDawn187,

Thank you for posting.

Very nice, your script solved my problem.

This pop-up window is no separate process, so may not be achieved by the process of closing
I think it would be better if you use WinGetClassList, because my window title is: Microsoft Windows, it is easy to repeat with the other windows.
If you use the check window title and class methods, as it should be more accurate?
However, I am new AU3er, I can't write the script.

Edited by i2i8

Share this post


Link to post
Share on other sites

That's correct, In that case using the window class would be more accurate. Though, You don't need to do WinGetClassList since you already used the Au3Info tool. Try WinExists("[CLASS:#32770]"). Based on the Windows Info you provided, That should work.

Share this post


Link to post
Share on other sites

Very good, using the class can close the window.

Thank BlackDawn187, your script has helped me a lot, I've decided to use your script to solve my problem.

However, I still want to learn how to use WinGetClassList can solve this problem, the following is my script, however, does not work, please help me.

Local $aWindow = WinList()
Local $hWindow, $szTitle, $szCLASS
For $a = 1 To $aWindow[0][0]
    $hWindow = $aWindow[$a][1]
    $szTitle = $aWindow[$a][0]
    
If StringInStr($szTitle, "Microsoft Windows") Then

    If '[CLASS:#32770]' = WinGetClassList($hWindow) Then
    
            WinClose($hWindow)
            ExitLoop
    
        EndIf
    EndIf

Next

Also, add in what position, when the window pops up, close it, and then quit AU3 exit.

Share this post


Link to post
Share on other sites

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Thank you BrewManNH , but my situation is not the same with that.
This window is after the LAN diskless client starts, the virtual partition is loaded pop-up window, I tried: CHKNTFS / X volume; Disabled ShellHWDetection services; CHKDSK command;
Stop gpedit.msc in the autoplay option can not solve my problem, so I want to use AU3 solve this problem.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0