USMCGalloway Posted August 14, 2013 Share Posted August 14, 2013 (edited) I am trying to see if a box has a check mark in it or not. From that point I need to check a variable, to see if it needs to be check or not. For some reason PixelSearch does not seem to want to work with Switch Statements. $Var = "" Switch $Var Case $Var = "Primary" $coord = PixelSearch(404,248,404,248,0x000000) If @Error Then Send("{Space}") WinActivate("Untitled - Notepad") Sleep(500) Send("1") EndIf Case $Var = "" $coord = PixelSearch(404,248,404,248,0x000000) If NOT @error Then Send("{SPACE}") WinActivate("Untitled - Notepad") Sleep(500) Send("2") EndIf EndSwitch The notepads are in there because I was curious to which case statement it was stepping into. In this case it is always going into the first one. This is checking $Var and doing the pixelsearch for the checkmark, if an error comes up, hit space to put a check mark in the box. The next case statement is the same, only if it is not an @error, it will remove the check mark. $coord = PixelSearch(404,248,404,249,0x000000) If not @error Then Switch $CmdLine[1] Case $CmdLine[1] = "Primary" Case $CmdLine[1] = "" Send("{SPACE}") EndSwitch EndIf $coord = PixelSearch(404,248,404,249,0x000000) If @error Then switch $CmdLine[1] Case $CmdLine[1] = "" ;do nothing Case $CmdLine[1] = "Primary" Send("{SPACE}") EndSwitch endif Here is another variation I tried, as well, which goes in my head like, If no error( meaning there is a black check mark) Then test to see if it needs to be there( Primary needs a check mark, "' does not") , then a space will toggle the check mark. The second one will be skipped if the box is black, or will step into it and do the same as the previous one . Edited August 14, 2013 by USMCGalloway Link to comment Share on other sites More sharing options...
Bert Posted August 14, 2013 Share Posted August 14, 2013 Ummm, have you tried to see if you can hook the control directly so you can read it's state? That would be MUCH easier and more stable. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
USMCGalloway Posted August 14, 2013 Author Share Posted August 14, 2013 Honestly , I haven't even seen anything about that. Do you think I would be able to use that with a program running in Cirtix? Looking over it I do not think so, but I could be wrong, also that code is easier . 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