Jump to content

How to Select Radio buttons in the GUI


ur
 Share

Recommended Posts

I have below screen when I launch the application.

license.png

By default the first radio button is checked.

I want to select the second radio button as highlighted.

And when it is selected, the textbox highlighted will be enabled and we need to enter the license details.

 

To do that, I tried to get the control id with windo info tool , but I am getting the second section(Concurrent Licenses) completely as "Button" class with ID 12.But not that radiobutton ID.

Even I tried with that as below.

$hwd =WinWaitActivate("erwin Data Modeler Licensing","Acquire concurrent u")
ControlCommand($hwd,"","[CLASS:Button; INSTANCE:12]","Check")

But not working.

Any suggestions please.

Link to comment
Share on other sites

Thanks @Subz

Your code is working but it is like depending on the shortcut key, but handling with a control id is more helpful.

For the textbox part, I got the control ID and the below code is working to add the text there.

ControlCommand($hwd,"","[CLASS:Edit; INSTANCE:3]","EditPaste", 'string')

Is there any similar approach to handle the radio buttons also and how to get the Control ID for it, as windowinfo is not getting that text.

Link to comment
Share on other sites

19 hours ago, Subz said:

Can you try, this works on the latest version of CA Erwin Data Modler (except the latest instance is 14 rather than 12) 

ControlCommand($hwd,"","[CLASS:Button; INSTANCE:2]","Check")
ControlSend($hwd, "", "[CLASS:Button; INSTANCE:12]", "!W")

 

Thanks @Subz

It is selecting the radio button, but how did you get the ID for this?

 

Link to comment
Share on other sites

ControlSetText is not working in this case for textbox.

I tried 

$time_out = 120
Func _WinWaitActivate1($title,$text,$timeout=$time_out);Will Return the window Handler
    ;Logging("Waiting for "&$title&":"&$text)
    $dHandle = WinWait($title,$text,$timeout)
    if not ($dHandle = 0) then
        If Not WinActive($title,$text) Then WinActivate($title,$text)
        return WinWaitActive($title,$text,$timeout)
    Else
        ExitProgram("Timeout occured while waiting for the window...")
    EndIf
 EndFunc
$erwin = 'C:\Program Files\erwin\Data Modeler r10\erwin.exe'
Run($erwin)
$hwd = _WinWaitActivate1("erwin Data Modeler Licensing","Acquire concurrent u")
ControlCommand($hwd,"","[CLASS:Button; INSTANCE:2]","Check")

ControlSetText($hWnd, "","1425", "This is some text")
;ControlSetText($hWnd, "","[ID:1425]", "This is some text")
;ControlSetText($hWnd, "","[CLASS:Edit; INSTANCE:3]", "This is some text")

But none of the below statements working, any help?

ControlSetText($hWnd, "","1425", "This is some text")
ControlSetText($hWnd, "","[ID:1425]", "This is some text")
ControlSetText($hWnd, "","[CLASS:Edit; INSTANCE:3]", "This is some text")

Link to comment
Share on other sites

Not sure why the last one isn't working for you, it works fine for me have included what works for me + how I got the Instance for the buttons:

$hwd = WinWaitActive("CA ERwin Data Modeler Licensing","Acquire concurrent u")
Local $sControl
For $i = 0 To 100
    $sControl = ControlGetText($hwd, "", "[CLASS:Button; INSTANCE:" & $i & "]")
    If $sControl <> "" Then ConsoleWrite($i & " = " & $sControl & @CRLF)
Next

;~ These commands work for me
ControlCommand($hwd, "", "[CLASS:Button; INSTANCE:2]", "Check")
ControlSetText($hwd, "", "[CLASS:Edit; INSTANCE:3]", "This is some text")

 

Link to comment
Share on other sites

I didn't get you.

Are you telling about saving the license server details in the registry directly instead of entering in the UI?

Actually we are testing whether dialogs are coming or not correctly, so automating the UI part itself.The registry part is already completed

Link to comment
Share on other sites

Hi @Subz

I need one more help from you.

Is there anyway to read or write 64 bit registries from 32 bit exe.

As my exe should be able to run on both the 32 and 64, I have compiled it to 32 bit and it not accessing the 64 bit hive.

Can you please suggest.

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

×
×
  • Create New...