Jump to content

which function to use to know whether check box is in Read only mode or not


Recommended Posts

  • Moderators

vis,

Welcome to the AutoIt forum. :)

I am assuming this is a checkbox in an external application - so I suggest trying ControlCommand with the IsEnabled command. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks M23 for helping ,

but i have already used the below mentioned code:

Local $iCheck = ControlCommand("Options","checkbox","IsEnabled",288)
    
      If $iCheck == 0 Then
         $sRemark = "PASS"
         Sleep(5000)
      ControlClick("Options","checkbox",288)
   
      ControlClick("Options","OK",1)

else

$sRemark = "ALREADYCHECKED" 
       ControlClick("Options","OK",1)

[in the else part i have used controlclick for OK button only i.e. if checkbox is already checked no need to check it, becuse if i do that it will uncheck the checkbox

AND ,what i want from this code is that if my checkbox is already checked/Enabled then it should not click on the checkbox or is should show the prompt that your checkbox is already ckecked.

please help

Link to comment
Share on other sites

Thanks M23 for helping ,

but i have already used the below mentioned code:

Local $iCheck = ControlCommand("Options","checkbox","IsEnabled",288)

If $iCheck == 0 Then

$sRemark = "PASS"

Sleep(5000)

ControlClick("Options","checkbox",288)

ControlClick("Options","OK",1)

else

$sRemark = "ALREADYCHECKED"

ControlClick("Options","OK",1)

[in the else part i have used controlclick for OK button only i.e. if checkbox is already checked no need to check it, becuse if i do that it will uncheck the checkbox

AND ,what i want from this code is that if my checkbox is already checked/Enabled then it should not click on the checkbox or is should show the prompt that your checkbox is already ckecked.

please help

you need to decide whether you want to test if it's enabled or checked

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Then you should use the "IsChecked" command and not the "IsEnabled".

But before you do that you should take a good and proper look at it in the help file, because you seem to have wrong parameters.

You'll need to use the window info toll in autoit install dir to get the control id of your target.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

hi john i have already used "IsChecked" command but didn't get success, and in the code mentioned above i have used the window info tool, 288 mentioned above is the checkbox ID,,

can you provide me the code for " if the checkbox is already checked then it prompt a message that your checkbox is checked already, so not need to check it.

Link to comment
Share on other sites

>>>> Window <<<<
Title:     Options
Class:    #32770
Position:    8, 8
Size:    433, 507
Style:    0x94C800C4
ExStyle:    0x00010101
Handle:    0x002602BE

>>>> Control <<<<
Class:    Button
Instance:    13
ClassnameNN:    Button13
Name:    
Advanced (Class):    [CLASS:Button; INSTANCE:13]
ID:    288
Text:    Checkbox
Position:    63, 149
Size:    330, 16
ControlClick Coords:    77, 4
Style:    0x50010003
ExStyle:    0x00000004
Handle:    0x001D08A0
 

Link to comment
Share on other sites

Local $iCheck = ControlCommand("Options", "", "[CLASS:Button; INSTANCE:13]", "IsChecked")
    
If $iCheck Then
    $sRemark = "Is checked"
Else
    $sRemark = "Is not checked"
EndIf

MsgBox(0,"state", $sRemark)

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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