uncheck a chekbox

Started by siocnarf, October 30, 2018, 10:50:58 AM

Previous topic - Next topic

siocnarf

Hi,

I have to select a checkbox and disabling it.

I did a try with this without success:

;Title: <untitled>
;ID: 4655
;Class: BOTreeList
;Level: 3

; Default cWndByWndSpec seems OK here
window1=cWndByWndSpec("#32770","_su50",12,20,2,21,22,23,0,0,0,0,0,0,0)
; window1=cWndByWndSpecName("Installation de Business Objects - Etape 4","_su50",12,20,2,21,22,23,0,0,0,0,0,0,0)
; window1=DllHwnd('Installation de Business Objects - Etape 4')
window2=cWndBySeq(window1,12)
ControlHandle=cWndByID(window2,4655)
; or ControlHandle=cWndByName(window2,`3~`)
; or ControlHandle=cWndByClass(window2,`BOTreeList`)
; or ControlHandle=cWndBySeq(window2,4)
cSetFocus(ControlHandle)  ; Activates Window

;Title: 0
;ID: 4655
;Class: BOTreeList
;Level: 3

; Default cWndByWndSpec seems OK here
;window1=cWndByWndSpec("#32770","_su50",12,20,2,21,22,23,0,0,0,0,0,0,0)
window1=cWndByWndSpecName("Installation de Business Objects - Etape 4","_su50",12,20,2,21,22,23,0,0,0,0,0,0,0)
; window1=DllHwnd('Installation de Business Objects - Etape 4')
window2=cWndBySeq(window1,12)
;ControlHandle=cWndByID(window2,4655)
; or ControlHandle=cWndByName(window2,`0~`)
; or ControlHandle=cWndByClass(window2,`BOTreeList`)
ControlHandle=cWndBySeq(window2,4)
;result=cEnableState(ControlHandle,-1)
;Message("Enable Status",result)     ;TODO - Remove Message.  Add code
cEnableState(ControlHandle,0)

td

Since you may be dealing with a Treeview, Listview or Listbox control, you may want start by reviewing the following article.

http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WIL~Extenders/Control~Manager+How~to~deal~with~SOME~Listboxes~that~have~check~boxes.txt

You could also take peek at the cSetTvItem, cGetTVItem,  cGetLvSelText and cSetLVItem in the Consolidated WIL Help file.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

Looking at your Roboscipter generated script a little more carefully, it would appear that you have a custom or at least non-common control window to deal with.  If that is the case you may be stuck with using mouse click and/or keystroke WIL functions to accomplish or task.  Unless you can come up with an alternative that does not rely on automating your programs UI.  Perhaps .Net or COM Automation.   
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

siocnarf

Quote from: td on October 30, 2018, 09:59:59 PM
Looking at your Roboscipter generated script a little more carefully, it would appear that you have a custom or at least non-common control window to deal with.  If that is the case you may be stuck with using mouse click and/or keystroke WIL functions to accomplish or task.  Unless you can come up with an alternative that does not rely on automating your programs UI.  Perhaps .Net or COM Automation.
Hi,

But sendkey require the session is open and unlock. I can control to be sure the session is open but not if the send key will work because the session may be lock. Any idea?

Thanks,

td

If you are referring to a single user's logon session, then SendKey does require that the interactive desktop is associated with the user session running the targeted UI process.  It would have been better if you had saved potential readers time by mentioning that requirement in your original post.

To answer the question directly, no ideas other than the previously mentioned idea of dropping the UI automation approach.  Windows does have the UI Automation API but it requires that the targeted none Common Control-based application is built with support for the UI Automation provider COM Automation interfaces and it is extremely difficult to write a working .Net-based script that uses that API, even when the targeted application does support it. 
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

siocnarf

Quote from: td on October 31, 2018, 08:04:18 AM
If you are referring to a single user's logon session, then SendKey does require that the interactive desktop is associated with the user session running the targeted UI process.  It would have been better if you had saved potential readers time by mentioning that requirement in your original post.

To answer the question directly, no ideas other than the previously mentioned idea of dropping the UI automation approach.  Windows does have the UI Automation API but it requires that the targeted none Common Control-based application is built with support for the UI Automation provider COM Automation interfaces and it is extremely difficult to write a working .Net-based script that uses that API, even when the targeted application does support it.

From my test, if the user has a lock session or is logoff then Sendkey is just failing. The session need to be open and unlock.

Thanks,

td

If a user is logged off or the secure logon-on (or screensaver) desktop is displaying then the interactive desktop is not active for the session.  So as I previously mentioned, the interactive desktop is required to use the WIL keyboard and mouse functions.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade