Jump to content

How Can I Check the State of a CheckBox..?


Recommended Posts

thanx for the help.. but im still a lil confused though.. been up for too long.. :o:D

Would you mind giving me an example code/script please of: getting the object reference of a checkbox by its name/ID, then determining if its ticked or unticked, then message box if its ticked or unticked..

Link to comment
Share on other sites

#include <IE.au3>

Dim $o_IE = _IECreate('http://www.w3schools.com/html/tryit.asp?filename=tryhtml_checkbox')
Dim $oFrame = _IEFrameGetObjByName($o_IE, 'view')
Dim $oChecks = _IETagNameGetCollection($oFrame, 'input')

For $i = 1 To 2
    For $oCheck In $oChecks
        ConsoleWrite(_IEFormElementGetValue($oCheck) & @TAB & 'Is ')
        If $oCheck.Checked Then
            ConsoleWrite('checked' & @LF)
        Else
            ConsoleWrite('not checked' & @LF)
        EndIf
        
        $oCheck.Checked = True
    Next
Next

Link to comment
Share on other sites

#include <IE.au3>

Dim $o_IE = _IECreate('http://www.w3schools.com/html/tryit.asp?filename=tryhtml_checkbox')
Dim $oFrame = _IEFrameGetObjByName($o_IE, 'view')
Dim $oChecks = _IETagNameGetCollection($oFrame, 'input')

For $i = 1 To 2
    For $oCheck In $oChecks
        ConsoleWrite(_IEFormElementGetValue($oCheck) & @TAB & 'Is ')
        If $oCheck.Checked Then
            ConsoleWrite('checked' & @LF)
        Else
            ConsoleWrite('not checked' & @LF)
        EndIf
        
        $oCheck.Checked = True
    Next
Next
@Authenticity: I like the use of w3schools example page to demo. Sweet!

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...