Champak Posted May 1, 2008 Share Posted May 1, 2008 I'm communicating with another app and I need to check some checkboxes. Sometimes the checkboxes don't always check....not because of the cpu load. I've tried a few different things to make sure the boxes ALWAYS gets checked and none of them are flawless and I just wanted to know if that is "just" how it is. I've tried controlfocus and then controlcommand with "Check" I've tried a "do...until" in between is controlcommand with "Check", and the until is until controlcommand with "IsChecked". (hope that is clear) Neither ALWAYS works. So is there any other suggestions on how to make sure all checkboxes are always checked? Link to comment Share on other sites More sharing options...
martin Posted May 1, 2008 Share Posted May 1, 2008 I'm communicating with another app and I need to check some checkboxes. Sometimes the checkboxes don't always check....not because of the cpu load. I've tried a few different things to make sure the boxes ALWAYS gets checked and none of them are flawless and I just wanted to know if that is "just" how it is.I've tried controlfocus and then controlcommand with "Check"I've tried a "do...until" in between is controlcommand with "Check", and the until is until controlcommand with "IsChecked". (hope that is clear)Neither ALWAYS works. So is there any other suggestions on how to make sure all checkboxes are always checked?Don't know, but if ControlCommand gives the correct result with "IsChecked" then maybe ControlClick will change the state reliably. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Champak Posted May 1, 2008 Author Share Posted May 1, 2008 This is what I did which seems to work thus far no matter what. Essentially, I kept the do...until, but I added a controlfocus and something to compensate for CPU load within the sleep.ViewFunctions(31502, $DefaultCheck[2][0], $DefaultCheck[2][1]);A bunch more of these Func ViewFunctions($Control, $State, $StateResult);DONE Do ControlFocus("Dingo", "", $Control) Sleep(10) ControlCommand ( "Dingo", "", $Control, $State) Until ControlCommand ( "Dingo", "", $Control, "IsChecked") = $StateResult Sleep(5 + CPUSleeper($SleepEx)) EndFunc Func CPUSleeper($SleepEx) If Not ProcessExists("taskmgr.exe") Then Return ;This will prevent autoit error because of not seeng the task manager $Sleeper = StatusbarGetText("Windows Task Manager", "", 2) $Sleeper = StringSplit($Sleeper, " ") $Sleeper = StringSplit($Sleeper[3], "%") ;_ConsoleWrite($Sleeper[1]) If $Sleeper[1] > 90 Then $CPUSleep = 500 ElseIf $Sleeper[1] > 60 Then $CPUSleep = 250 ElseIf $Sleeper[1] > 40 Then $CPUSleep = 100 Else $CPUSleep = 0 EndIf _ConsoleWrite("!CPU COMPENSATOR SLEEP EXTENDER +++++++++++++ Load: " & $Sleeper[1] & "%") Return $CPUSleep EndFunc ;==>CPUSleeperBut I do have a question on what I've done here. I don't like the way I have to read the CPU by opening up the task manager. I've seen a couple other versions similar to:http://www.autoitscript.com/forum/index.ph...st&p=490357but they are too slow. Is there a better way to do this without calling the task manager and hiding it? I feel there has to be. 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