st4vr0s Posted January 24, 2012 Share Posted January 24, 2012 Hi, I'm writing a test scrip that opens an application, sets my variables by selecting certain options within preferences and then runs the program. These options are selected by ticks in boxes. As I will be running the program a number of times I do not want it to tick or untick my chosen preferences each time I run it. Is it possible for the script to check if the tick is already present and not to select if it is? Thanks Link to comment Share on other sites More sharing options...
hannes08 Posted January 24, 2012 Share Posted January 24, 2012 If you know the position of the item you could use PixelGetColor() to see whether it's checked or not. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
bogQ Posted January 24, 2012 Share Posted January 24, 2012 (edited) On some lvl it is if we are talking about normal check boxHere is example bassed on XP volume controllIf WinExists('Volume Control') Then WinActivate('Volume Control') WinWaitActive('Volume Control') Else MsgBox(16,'No win to play with','Pls start volume control from notification area before you run the script next time' & @CRLF & 'Script will now exit') Exit EndIf $check = ControlCommand ( "Volume Control", "", '[CLASS:Button; INSTANCE:2]', "IsChecked", "" ) If $check Then MsgBox(32,'Status of box is '&$check&' Checked','we will attempt to change it') ControlCommand ( "Volume Control", "", '[CLASS:Button; INSTANCE:2]', "UnCheck", "" ) $check = ControlCommand ( "Volume Control", "", '[CLASS:Button; INSTANCE:2]', "IsChecked", "" ) If Not $check Then MsgBox(64,'Status of box is '&$check&' Unchecked','Script will now exit') Else MsgBox(16,'Status of box is '&$check&' Checked','Nothing happens, reason unknown, script will now exit') EndIf Else MsgBox(32,'Status of box is '&$check&' Unchecked','we will attempt to change it') ControlCommand ( "Volume Control", "", '[CLASS:Button; INSTANCE:2]', "Check", "" ) $check = ControlCommand ( "Volume Control", "", '[CLASS:Button; INSTANCE:2]', "IsChecked", "" ) If $check Then MsgBox(64,'Status of box is '&$check&' Checked','Script will now exit') Else MsgBox(16,'Status of box is '&$check&' Unchecked','Nothing happens, reason unknown, script will now exit') EndIf EndIf Edited January 24, 2012 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
st4vr0s Posted January 26, 2012 Author Share Posted January 26, 2012 Cheers guys, Thanks for the help If PixelGetColor(35, 333) = 0xFFFFFF Then ControlClick ("general","3.4.7","[ID:1115]") Else EndIf Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now