Jump to content

Message Box - Controlclick returns success but the message box remains - (Moved)


 Share

Recommended Posts

Hello Team,

I am working on automating an installer package which prompts with a msgbox (yes/no) type in between.

Auto it finds the message box and the Controlclick commands returns 1 but the message box continue to stay. 

 

Summary of the Control I am trying to click:

>>>> Window <<<<
Title:    Install Finished
Class:    #32770
Position:    481, 173
Size:    357, 335
Style:    0x94C801C5
ExStyle:    0x00010101
Handle:    0x00D10362

>>>> Control <<<<
Class:    Button
Instance:    1
ClassnameNN:    Button1
Name:    
Advanced (Class):    [CLASS:Button; INSTANCE:1]
ID:    6
Text:    &Yes
Position:    149, 259
Size:    88, 26
ControlClick Coords:    39, 8
Style:    0x50030000
ExStyle:    0x00000004
Handle:    0x014302D0

>>>> Mouse <<<<
Position:    677, 471
Cursor ID:    0
Color:    0xF0F0F0

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
&Yes
&No

Would you like to restart Tomcat server now?

>>>> Hidden Text <<<<

 

So far i have tried these options but none gave me result:

#RequireAdmin is set

Method 1:

WinWait("Install Finished", "")
WinActivate("Install Finished", "")
ControlFocus("Install Finished", "",6)
ControlSend("Install Finished", "",6, "{Enter}")

Method 2:

WinWait("Install Finished", "")

WinActivate("Install Finished", "")
ControlFocus("Install Finished", "",6)
$Success=ControlClick("Install Finished", "", 6, "left", 1)
Switch $Success
    Case 0
        MsgBox(16,"Autoit","ControlClick Failed")
    Case 1
        MsgBox(0,"Autoit","ControlClick Success")
EndSwitch
 

Note: This method returns 1(success) but nothing happens on the screen

Method 3:

WinSetState("Install Finished", "", @SW_ENABLE)
WinActive("Install Finished", "")
ControlSend("Install Finished", "", 6, "{ENTER}")
Sleep(250)
$title2 = "Install Finished"; the message title
If WinExists($title2) Then
        WinActivate($title2)
        $check=WinWaitActive($title2)
        If($check) Then
           $yesHandle = ControlGetHandle($check, '', "[TEXT:&Yes]")
           ControlClick($check, "", $yesHandle)
         If($yesHandle) Then
             ControlFocus($yesHandle, "",6)
              ControlClick($yesHandle, "",6)
        MsgBox($MB_SYSTEMODAL, "", $yesHandle)
        EndIf
    EndIf
  EndIf

Method 4:

WinWaitActive("Install Finished", "")

ControlClick ("[CLASS:#32770]", "&Yes", 6, "left", 1)

 

Method 5:

WinActivate("Install Finished", "")
$handle = WinGetHandle("Install Finished", "&Yes")
ControlSend("Install Finished","&Yes",$handle,"!y")

Send("{Space}")

While True
   if WinExists("Install Finished", "") Then
      WinActivate("Install Finished", "")

      Send("{Space}")
   EndIf
   WEnd
ControlClick("Install Finished", "", "[Class:Button; INSTANCE:1]")

None of these are closing the message box successfully even though the click is a success- Is there anything i am missing?

 

 

Edited by ChethanSG
Highlighting summary
Link to comment
Share on other sites

Something like this?

WinWait("[CLASS:#32770; TITLE:Install Finished]", "Would you like to restart Tomcat server now?")
ControlClick("[CLASS:#32770; TITLE:Install Finished]", "Would you like to restart Tomcat server now?", "[CLASS:Button; INSTANCE:1]")

You'll want to make sure you read the help file for the title definition and control definition

Edited by MetaSteel
typo in code
Link to comment
Share on other sites

  • Developers

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

HEllo :)

Can you try this and say us?

WinWait("[CLASS:#32770; TITLE:Install Finished]", "Would you like to restart Tomcat server now?")
Sleep(500)
ControlClick("[CLASS:#32770; TITLE:Install Finished]", "Would you like to restart Tomcat server now?", "[CLASS:Button; INSTANCE:1]","left",1)

 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

On 2/12/2019 at 7:25 PM, jdelaney said:

Do you happen to have multiple windows with that title?

No.. its a single window 

8 hours ago, caramen said:

HEllo :)

Can you try this and say us?

WinWait("[CLASS:#32770; TITLE:Install Finished]", "Would you like to restart Tomcat server now?")
Sleep(500)
ControlClick("[CLASS:#32770; TITLE:Install Finished]", "Would you like to restart Tomcat server now?", "[CLASS:Button; INSTANCE:1]","left",1)

 

Same result as earlier, the msg box doesnt close.

The problem is not about identifying and clicking.

The problem is even after the click is success (1 returned by ControlClick), the window remains and doesnot close at all!

E01FC735.png

 

This is a msgbox of  (Yes/No) type. And Yes button is having an id 6

Edited by ChethanSG
Adding few more information
Link to comment
Share on other sites

nvm -.-

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

15 hours ago, Nine said:

If you can't find a solution, then why don't you kill that window and restart the server yourself...big problem requires big solution :)

This msgbox is displayed by a Wix Installer. I cant even kill this msgbox-even that fails. Killing process means killing the Installation itself. Note that this comes in the middle of installation, still few more steps are left before a complete installation. 

Very much required to address this, ,as this is going to be part of CI/CD Automated build deployments and Tests for every check-in

Link to comment
Share on other sites

Why not a 

WinWait

WinMove

Then MouseClick

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

  • 2 weeks later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...