Jump to content

ControlCommand Question


Recommended Posts

I have an autoIt script that I am using this command:

ControlCommand("Clientware", "", "Use Acrobat for Large Files (over 10MB)", "Check", "")

My question is will this always put a check in the box?  Even if there is already a check there?  I had been using a ControlClick and that was working fine until randomly a check was already in the box and the ControlClick was removing the check.

Thank you

 

Link to comment
Share on other sites

Pretty sure it will check it, and do nothing if already checked since its stating specifically to "check" not "toggle" but if that is not the case you can always run "ischecked" first to see if the value is 1 or 0 and then check as needed with an if statement. 

Link to comment
Share on other sites

I tried it but always return zero,

ControlCommand ( "DMS", "", "TwwCheckBox1", "IsChecked", "")  ;always return zero

ControlCommand ( "DMS", "", "TwwCheckBox1", "UnChecked", "") ;Not Working

ControlCommand ( "DMS", "", "TwwCheckBox1", "Checked", "") ;Working,Checking and Unchecking Box

maybe something is wrong with control command Checked, IsChecked and UnChecked

Edited by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Link to comment
Share on other sites

I just tested with the Notepad++ installer.  

Using "check" does not uncheck the box.  

ControlCommand("Notepad++ v6.7.8.2 Setup", "", 1200, "Check")

I do not even see what you used "Checked" in the command list. 

https://www.autoitscript.com/autoit3/docs/functions/ControlCommand.htm

 

Also "ischecked" is properly working for me.

$test = ControlCommand("Notepad++ v6.7.8.2 Setup", "", 1200, "IsChecked")
MsgBox(0, "", $test)

 

Link to comment
Share on other sites

  • Moderators

232showtime,

Nothing is wrong with the ControlCommand. It is just that some applications do not react to some commands in a standard manner, particularly "IsChecked". In the past it has sometimes proved necessary to resort to Pixel* functions to determine the state of a checkbox.

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

​typo error, whats with the 1200 value?

​Just the ID of the checkbox in that Notepad++ installer.  Its Classname was "Button4"

I used something that was free to download so you could test/try for yourself, but it seems based on what Melba said that most likely its just the application your working with that does not provide results as desired. 

So you may do what I did when I first got into Autoit and I was doing purely keyboard commands for automation.  In your case the + key should check the box and the tab key can tab down to its location. 

+ is not going to uncheck it (like Space would) so its safe to use without knowing its state ahead of time.

Edited by ViciousXUSMC
Link to comment
Share on other sites

Hey Everyone,

           Thank you for all the help.  After much testing yesterday, the only thing that worked was the Send Command,   Tab to the correct option, Send a + key. Puts a check mark in that box every time no matter if the box is checked or unchecked.

WinActive("ClientWare")
Sleep (4000)
Send("{TAB}{TAB}{TAB}{TAB}")
Sleep (1000)
Send("{+}")

This is what is working for me.   

Again many thanks for pointing me in the right direction.

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