Sign in to follow this  
Followers 0
vladimir100

Cannot click button OK

5 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thank you very much, Varian.

I'm impressed how fast you answer.

The application I'm working with is InstallShield.

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