Jump to content

Cannot click button OK


Recommended Posts

I have a very simple dialog box with the title "Installer" and class "SunAwtFrame".

It has one ComboBox and 2 buttons OK and Cancel.

This is my code

$path = "C:\Users\Administrator\Desktop\cpx660-b883-Windows\DocuShare\"

ShellExecuteWait($path & "docushare.exe")

$rc = WinActivate("Installer")

While $rc == 0

Sleep(5000)

$rc = WinActivate("Installer")

WEnd

ControlFocus("Installer","","[CLASS:Button;INSTANCE:1]") ; This function works

ControlClick("Installer","","[CLASS:Button;INSTANCE:1]") ; This function does not work

I also tried Send("{ENTER}"). It does not work.

What should I do?

Thanks,

Vladimir

Edited by vladimir100
Link to comment
Share on other sites

You can try something like this for debugging purposes

Do
    WinActivate("Installer")
    $Visible = ControlCommand("Installer","","[CLASS:Button;INSTANCE:1]", "IsVisible", "")
    Sleep(10)
Until $Visible
Do
    WinActivate("Installer")
    $Clicked = ControlClick("Installer","","[CLASS:Button;INSTANCE:1]")
    Sleep(10)
Until $Clicked

Link to comment
Share on other sites

You can try something like this for debugging purposes

Do
    WinActivate("Installer")
    $Visible = ControlCommand("Installer","","[CLASS:Button;INSTANCE:1]", "IsVisible", "")
    Sleep(10)
Until $Visible
Do
    WinActivate("Installer")
    $Clicked = ControlClick("Installer","","[CLASS:Button;INSTANCE:1]")
    Sleep(10)
Until $Clicked

Thank you, Varian and you look great on the picture.

I found that even the OK button was in focus when I manually pressed the Enter button on the keyboard nothing happened.

Only the mouse click works.

The dialog box class is Java SunAwtFrame.

The ControlClick returns 1 (success) but nothing happens.

The MouseClick requires the coordinates and it's fragile since I cannot maximize the dialog box for the fixed position.

I appreciate any suggestions.

Thanks,

Vladimir

Edited by vladimir100
Link to comment
Share on other sites

What is the application, if you don't mind?

If nothing else works, Mouseclick may have to be the only option. Fear not, though, you can always:

With Opt('MouseCoordMode', 1)

  • get the positions of the controls (relative to the parent window) with ControlGetPos()
  • Get the Window Position with WinGetPos(), which gives you the the absolute(Desktop) coordinates
  • Add the X's and the Y's to get the Controls absolute(Desktop) coordinates
  • Move the mouse and click

OR

With Opt('MouseCoordMode', 2)

  • get the positions of the controls (relative to the parent window) with ControlGetPos()
  • Move the mouse and click
Link to comment
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
 Share

  • Recently Browsing   0 members

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