viewpoint-particle

Author Topic: uncheck a chekbox  (Read 75 times)

siocnarf

  • Newbie
  • *
  • Posts: 30
uncheck a chekbox
« on: October 30, 2018, 10:50:58 am »
Hi,

I have to select a checkbox and disabling it.

I did a try with this without success:

Code: [Select]
;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

  • Tech Support
  • *****
  • Posts: 2618
    • WinBatch
Re: uncheck a chekbox
« Reply #1 on: October 30, 2018, 11:49:54 am »
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.
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates


td

  • Tech Support
  • *****
  • Posts: 2618
    • WinBatch
Re: uncheck a chekbox
« Reply #2 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.   
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates


siocnarf

  • Newbie
  • *
  • Posts: 30
Re: uncheck a chekbox
« Reply #3 on: October 31, 2018, 06:09:15 am »
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

  • Tech Support
  • *****
  • Posts: 2618
    • WinBatch
Re: uncheck a chekbox
« Reply #4 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. 
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates


siocnarf

  • Newbie
  • *
  • Posts: 30
Re: uncheck a chekbox
« Reply #5 on: November 01, 2018, 08:30:31 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

  • Tech Support
  • *****
  • Posts: 2618
    • WinBatch
Re: uncheck a chekbox
« Reply #6 on: November 01, 2018, 01:22:20 pm »
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.
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates