Sign in to follow this  
Followers 0
m0ngr31

Trying to determine if a box is checked or not

3 posts in this topic

I'm trying to make a simple script that will turn off program updates (Java, adobe reader and flash, quicktime, ect), and it works great if every computer is on the same page, but some computers have already had Java update, for instance, disabled. This messes up my script because it assumes it needs to tab through the options and select certain checkboxes/radio buttons.

Is there a way to check if something is enabled already so I can just throw an IF statement in there? I've seen threads about checking the boxes for windows that AutoIt has created, but I'm not sure how to make it work in a regular window... Any suggestions?

Here's my code:

;Disable Adobe Reader Updates
Run("C:\Program Files\Adobe\Reader 10.0\Reader\AcroRd32.exe")
WinWaitActive("Adobe Reader")
Send("!en")
WinWaitActive("Preferences")
Send("uu!n{ENTER}")
WinWaitActive("Adobe Reader")
WinClose("Adobe Reader")
;Disable Flash Updates
Run("control C:\Windows\system32\FlashPlayerCPLApp.cpl")
WinWaitActive("Flash Player Settings Manager")
Send("{RIGHT}{RIGHT}{RIGHT}{TAB}{TAB}{DOWN}")
WinClose("Flash Player Settings Manager")
;Disable Java Updates
Run("C:\Program Files\Java\jre6\bin\javacpl.exe")
WinWaitActive("Java Control Panel")
Send("{RIGHT}{TAB}{TAB}{SPACE}")
WinWaitActive("Java Update - Warning")
Send("{TAB}{ENTER}")
WinWaitActive("Java Control Panel")
Send("{TAB}{TAB}{TAB}{TAB}{ENTER}{ENTER}")

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

To determine if a box of another application is checked use:

ControlCommand ("title", "text", controlID, "IsChecked")

Replace "title" and "text" with the corresponding data of the application to automate. The controlID can be determined by the AutoIt WindowInfo tool.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

or you can your the If else statement

if ControlCommand ("title", "text", controlID, "IsChecked") Then
condition here
Else

condition here
endif

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  
Followers 0