vladimir100 Posted January 17, 2011 Share Posted January 17, 2011 (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 January 17, 2011 by vladimir100 Link to comment Share on other sites More sharing options...
Varian Posted January 17, 2011 Share Posted January 17, 2011 You can try something like this for debugging purposesDo 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 More sharing options...
vladimir100 Posted January 18, 2011 Author Share Posted January 18, 2011 (edited) You can try something like this for debugging purposesDo 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 January 18, 2011 by vladimir100 Link to comment Share on other sites More sharing options...
Varian Posted January 18, 2011 Share Posted January 18, 2011 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) coordinatesAdd the X's and the Y's to get the Controls absolute(Desktop) coordinatesMove the mouse and clickORWith 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 More sharing options...
vladimir100 Posted January 18, 2011 Author Share Posted January 18, 2011 Thank you very much, Varian. I'm impressed how fast you answer. The application I'm working with is InstallShield. Link to comment Share on other sites More sharing options...
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