Jump to content
Sign in to follow this  
cypher175

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

Recommended Posts

cypher175

Is there anyway to check the status/state of a checkbox in a webpage to see if its ticked or unticked..??

Share this post


Link to post
Share on other sites
Authenticity

Get an object reference to the checkbox and use it's checked property as:

Dim $fChecked = $oCheck.Checked ; Return true if checked, false otherwise.

Share this post


Link to post
Share on other sites
cypher175

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..

Share this post


Link to post
Share on other sites
cypher175

Can anyone that knows how to do this, please give me an example..!!!

Share this post


Link to post
Share on other sites
Authenticity

#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

Share this post


Link to post
Share on other sites
PsaltyDS

#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

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  

×