Sign in to follow this  
Followers 0
ThomasQ

Help Checking Checkboxes

1 post in this topic

#1 ·  Posted (edited)

Hi All!

I got a bit of a problem. I need to check some checkboxes on a site, wich I can't seem to do (using _IEFormElementCheckboxSelect & _IEAction). I can't even seem to get back the value of the checkboxes. (using _IEFormElementGetValue).

Since I can't get the info I need straight from the Page Source, I use _IETagNameAllGetCollection, and then sift my way through the mess it returns!

So far I have been succesfull in finding and manipulating buttons, textarea's, some tables, and dropdown select boxes on the site. All of them using the _IEFormElementGett & Set Value function.

Through using $oElements = _IETagNameAllGetCollection($oIE), a For $oElement In $oElements / Next loop, and then checking the atrributes of $oElement, using $oElement.tagname, $oElement.id, $oElement.classname, $oElement.innertext & $oElement.Innerhtml.

Thanks to this I located on of the checkboxes them self (I think).. TAG nr 165.. This is wat it looks like when the checkbox is checked:

[165]tagname: SPANid: aui-3-2-0PR1-1141classname: v-checkboxinnertext: n.v.t.innerhtml: <INPUT id=gwt-uid-1 tabIndex=0 CHECKED type=checkbox __eventBits="241"><LABEL for=gwt-uid-1 __eventBits="241">n.v.t.</LABEL>

This is Unchecked:

[165] tagname: SPANid: aui-3-2-0PR1-1141classname: v-checkbox innertext:n.v.t.<INPUT id=gwt-uid-1 tabIndex=0 type=checkbox __eventBits="241"><LABEL for=gwt-uid-1 __eventBits="241">n.v.t.</LABEL>

Notice there is no attribute set to CHECKED, and that it's not even a UNCHECKED or something when it's unchecked on the page. It is not using "value=", so that's probably the reason the _IEFormElementGett & Set Value don't work. Also, after checking a freshly loaded page, abouy 8 TAG objects, wich seem to have something to do with that checkbox, get ID's, wich they previously didn't have.. Does anybody have any idea how I can manipulate those darn Checkboxes? How should I use the _IEFormElementCheckboxSelect on this checkbox? Is there any other way to check/uncheck a checkbox?? Many Thanks in advance!!

Edited by ThomasQ

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • MrCheese
      By MrCheese
      Hey Guys,
       
      So, the functions work, where primarygui() accurately determines the evaluation of the status of the checkboxes - the msgbox picks this up.
       
      However, later on, when we re-enter a 'for $i = 0 to ubound($checkbox)' loop, then in the 'batchinitial' function it doesn't picked up that the status&$i = 1, so it jumps out, then within the While 1 loop, it exits the loop in the first row, again because the status& $i= 0
      The "assign" line within the primarygui funtion, is this only a local assignment? if so, how can I make it cross function?
       
      Thank in adv for your help
       
       
      Func excelsheetlist() $i = 0 Global $aWorkSheets = _Excel_SheetList($oWorkbook1) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_SheetList Example 1", "Error listing Worksheets." & @CRLF & "@error = " & @error & ", @extended = " & @extended) ;_ArrayDisplay($aWorkSheets, "Excel UDF: _Excel_SheetList Example 1") ;_ArrayDisplay($aWorkSheets, "Array") Global $iRows = UBound($aWorkSheets, $UBOUND_ROWS) ; Total number of rows. In this example it will be 10. Global $iCols = UBound($aWorkSheets, $UBOUND_COLUMNS) ; Total number of columns. In this example it will be 20. Global $iDimension = UBound($aWorkSheets, $UBOUND_DIMENSIONS) ; The dimension of the array e.g. 1/2/3 dimensional. MsgBox($MB_SYSTEMMODAL, "", "The array is a " & $iDimension & " dimensional array with " & _ $iRows & " row(s) & " & $iCols & " column(s).") Dim $checkbox[$iRows] EndFunc ;==>excelsheetlist Func primarygui() ; Create a GUI with various controls. Local $hGUI = GUICreate("Script Controller", 300, ($iRows * 24)) ; Create a checkbox control. ;Local $idCheckbox = GUICtrlCreateCheckbox("Standard Checkbox", 10, 10, 185, 25) Local $Button2 = GUICtrlCreateButton("Close", 210, 200, 85, 25) Local $Button3 = GUICtrlCreateButton("Run", 210, 170, 85, 25) Local $Button1 = GUICtrlCreateButton("Discharge", 210, 140, 85, 25) For $i = 0 To UBound($checkbox) - 1 $checkbox[$i] = GUICtrlCreateCheckbox($aWorkSheets[$i][0], 8, 0 + ($i * 24)) ;, 81, 17) Next ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $Button2 ;Close Exit Case $nMsg = $Button1 MsgBox(0, "Discharge Button not configured", "Now Exiting") Exit Case $nMsg = $Button3 ;Run $fSelection = False For $i = 0 To UBound($checkbox) - 1 If BitAND(GUICtrlRead($checkbox[$i]), $GUI_CHECKED) Then $fSelection = True ExitLoop EndIf Next If $fSelection Then For $i = 0 To UBound($checkbox) - 1 Assign("status" & $i, GUICtrlRead($checkbox[$i])) Next $batchcount = 0 For $i = 0 To UBound($checkbox) - 1 If Eval("status" & $i) = 1 Then $batchcount = $batchcount + 1 ;Call ("o" & $i & "copy") ; if you want to call the functions directly, remove ; before the call and comment or delete the following DirCopy statement MsgBox(0, "Checking", "Checking that: " & $checkbox[$i] & " no, with title: " & $aWorkSheets[$i][0] & " was selected, Batch count: " & $batchcount) ; if you need only the DirCopy EndIf Next ExitLoop Else MsgBox(48, 'No Items Selected', 'You have not selected any Patients to Load, Please select from the list') EndIf EndSelect WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>primarygui Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked Func batchinitial() If Eval("status" & $i) = 1 Then debugbox() $oWorkbook1.Sheets(1).Activate $bigloop = $bigloop + 1 $sheet = $aWorkSheets[$i][0] $oWorkbook1.Sheets($sheet).Activate debugbox() EndIf EndFunc ;==>batchinitial OpenExcel() excelsheetlist() primarygui() For $i = 0 To UBound($checkbox) - 1 batchinitial() While 1 If Eval("status" & $i) = 0 Then ExitLoop ;all the rest of my script loops etc WEnd Next  
    • 31290
      By 31290
      Hi everyone
      Hope you're doing great.
      Well, I'm writing a script that allows our Service Desk to clean several temp folder as a first diagnostic. 
      Indeed, the agent in charge of the issue will have to choose what to clean (web browsers temp folders, some windows one etc...)
      I added a progress bar to see the current state of the script but if I select more than one checkbox, it seems that the counting is not done properly and is directly filled at 100% (when at leat 2 boxes are checked) and I don"t get the final message saying that all is done, especially for if the last box is checked.
      But if I launch the process with only one checkbox checked,it's working...
      I've enclosed the au3 files for you because posting them in this post would be... unreadable lol. So you can maybe do some tests as well.
      I'm pretty sure the code can be optimized (a lot  ) and that there is a much better way to achieve what I want the script to be.
      Maybe can someone can give me a hand over here.
      Thanks in advance.
      31290
      SEE_Delete_Temp.au3
      SEE_Delete_Temp_Functions.au3
    • 31290
      By 31290
      Hi everyone, 
      I'm currently writing a script that will execute some Robocopy batches among what has been ticked by the Technician.
      The script is divided in two files (the main & the functions) but the thing is that I have to write multiple lines for all controls, as you can see in the functions file.
      1- Is there a way to shorten this?
      2- To avoid writing bunch of lines to check whether checkboxes are checked and to lunch appropriate bat, is there also a way to go quicker when clicking on the submit button? (will be implemented in the SubmitCopyChoice() Function)
      Thanks guys for all the help you can offer 
       
      Robocopy.au3
      Robocopy_Functions.au3