Set CheckBox using ControlManager

Started by JTaylor, October 28, 2020, 01:02:48 PM

Previous topic - Next topic

JTaylor

Having an issue with setting the value of a Checkbox in a Uniface app.   In using RoboScriptor....It doesn't have a "Name",  the ID changes with every query and it has a Class of "Button5".   When the window is present RoboScriptor does work as expected.   The problem is that the ID  changes as it queries each item so I can't use ID.   If I try cWndByClass or cFindByClass it tells me the parent window doesn't exist even if I use RoboScriptor to get info from that Window and use the resulting code/path for the Class functions.

Suggestions?

Jim

Code (winbatch) Select



; Default cWndByWndSpec seems OK here
window1=cWndByWndSpec("UniApplication","uniface",4,0,0,0,0)
window2=cWndByClass(window1,`MDIClient`)
window3=cWndByID(window2,1001)
window4=cWndByClass(window3,`uviewport`)
window5=cWndByID(window4,0)
;ControlHandle=cWndByClass(window4,"Button5")
ControlHandle=cFindByClass("Button5")
result=cCheckBox(ControlHandle, -1)     ;Examines a checkbox
Message("Checkbox setting",result)     ;TODO - Remove Message.  Add code.

td

Don't know anything about the program you are attempting to automate but it may be that the UI is not based on the standard Win32 UI model and is instead using one of several other UI interfaces currently available. Really don't have any suggestions other than ones I would not recommend like using keystrokes and mouse clicks. 
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

Okay.  Figured that would be the case but thought I would ask just in case.   The issue is that the change is dependent on the current setting and it doesn't recognize the +/- keystrokes like many checkboxes do.   Just found out I will be able to get the current setting via the data source being provided for the updates so will be able to solve it in that fashion.  That was still a question mark when I asked.

Thanks.

Jim

td

Since you have MSFT's development environment available to you, you might have several versions of Spy++ on your system.  It is part of the "real" Windows SDK and perhaps some versions of Visual Studio.  At any rate it is a handy tool.  I use it primarily for spotting bugs in applications and a few other interesting things. But it can be used to inspect the properties of application windows (along with their child windows) in great detail.  It can come in very handy when automating a UI.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

Yeah...thought of that but it is on someone else's machine over which I don't have much control.   Thanks again.

Jim

td

Presumedly you have some access to the system if you are running RoboScripter on it.  So all you would have needed was the Spy++ exe and a DLL or two. If I recall correctly - a big if, the exe is named spyxx.exe/spyxx_amd64.exe and the DLL is spyxxhk.dll/spyxxhk_amd64.dll.  Obviously, the different names are 32-bit/64-bit versions.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

Yeah...but guessing the SDK is not there as it is a production machine and not a development machine and not sure that would be doable.   Might be, someone just logs me in remotely to do a job and this issue was a bit of a road bump.  They were able to provide the needed info in the data to work around this problem so didn't pursue it any further.   Will keep this in mind though.  Thanks.

Jim

td

You don't need the SDK on a target machine.  You just need a copy of the SDK on your machine so you can grab Spy++ and drop it on the targeted machine. That is assuming you don't have direct access to the targeted application.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor