Jump to content
rnagulapalle

ControlCommand IsChecked returns 0

Recommended Posts

rnagulapalle

Hi,

I have script that returns 1  when i use option "IsEnabled" or "IsVisible" for a checkbox on a window but its returning 0 for "IsChecked" option though the checkbox is checked. Does anyone have the same problem?

Thanks

Rj

Share this post


Link to post
Share on other sites
guinness

Nope.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
AntoineV

I have the same Issue. 

The problem come when I use another class then normal button class.

In my script the class button is : WindowsForms10.Button.app.0.1ca0192_r13_ad1

This is a checkbok.

ControlCommand ("Title","Text","[CLASS:WindowsForms10.BUTTON.app.0.1ca0192_r13_ad1;INSTANCE:12]","IsChecked","")

What can we do ?

Share this post


Link to post
Share on other sites
jdelaney

Send the full output from the Control tab on the AutoIT Window Info tool...while focused on your checkbox.


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
jdelaney

Use the Name instead

ConsoleWrite(ControlCommand ("Title","Text","[NAME:checkBoxRequireApproval]","IsChecked","") & @CRLF)

If that doesn't do it...make sure you can grab the window handle with

WinGetHandle

Then, make sure you can get the control with

ControlGetHandle

Then use those handles in the Controlcommand function

Use this to validate the handel returns:

IsHWnd
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
AntoineV

I have the handle of the Windows with WinActivate then I use the command Send to move into the Windows. So i guess I have th handle ?

I have already use just the name and that doesn't work ...

By the way thank you for your help and if my english is bad it's because Im french ! haha

Share this post


Link to post
Share on other sites
xian_lhm

Hi, I'm a beginner of AutoIt. I have the same problem with checkbox state. I use ControlCommand to set the checkbox and it is worked. But before this command, I had to know the state of checkbox was checked or unchecked. I use GUICtrlRead("[NAME:checkBox1]") and it always return 0. Does anyone knows what happen? Thanks for help.

Share this post


Link to post
Share on other sites
Jos

GuiCtrlRead() is for you own developed GUI's. I assume you use ControlCommand() with "Check", so use "IsChecked" to check it's current status.
Post your script when you still have issues.

Jos 


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
xian_lhm
#include <Winapi.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>
Local     $I, $J, $sControl_ID
Dim $ObjTitle = "Demo Form"
Dim $aCheckBoxFlag[3][5] = [[1, 1, 0, 0, 1], _
                            [1, 1, 1, 1, 0], _
                            [0, 0, 0, 0, 1]]
Dim $aCheckBoxName[5] = ["checkBox1", "checkBox2", "checkBox3", "checkBox4", "checkBox5"]
$hWnd     =    WinWait($ObjTitle)       ; Wait For Win App Exist
$hWnd     =    WinActivate($ObjTitle)   ; Activate Win App
;
For $I = 0 To 2
    For  $J = 0 To 4
         $sControl_ID = "[NAME:" & $aCheckBoxName[$J] & "]"
         ControlFocus($hWnd, "", $sControl_ID)    ; Set Focus
         $Check_State = ControlCommand($hWnd, "", $sControl_ID, "IsChecked")
         MsgBox(0, $sControl_ID, $Check_State)
         If   ControlCommand($hWnd, "", $sControl_ID, "IsChecked")   Then
              ControlCommand($hWnd, "", $sControl_ID, "Uncheck")
         EndIf
         MsgBox(0, "$aCheckBoxFlag[" & $I & "][" & $J & "]", $aCheckBoxFlag[$I][$J])
         If   $aCheckBoxFlag[$I][$J] =  1    Then   ; Check The Check Box
              ControlCommand($hWnd, "", $sControl_ID, "Check", "")
         EndIf
      Next
Next

The $Check_State of every check box is 0 no matter what the real checkbox ischecked or Unchecked. Thanks for help. 

Share this post


Link to post
Share on other sites
Zedna

1) Try to use ClassNameNN as "controlID" instead of "[NAME:]"

2) Try ControlCommand(title, text, controlId, 'IsChecked','') instead of ControlCommand(title, text, controlId, 'IsChecked')

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

×