Guest nosfera2 Posted September 15, 2005 Share Posted September 15, 2005 (edited) Evening folks, I want a script to pause until a specific button is pressed. Having done some research I discovered I need to write a loop that exits when said button is clicked. I also need to use the ControlCommand function. So far I have this -> ControlCommand ("Virtual Memory", "", "1165", "IsEnabled", "") pathetic I know, but how do I wrap this into a loop and is this right at all? TIA Edited September 15, 2005 by nosfera2 Link to comment Share on other sites More sharing options...
GaryFrost Posted September 15, 2005 Share Posted September 15, 2005 Might try something like the following: While Not ControlCommand ("Virtual Memory", "", "1165", "IsEnabled", "") Sleep ( 100 ) Wend SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Guest nosfera2 Posted September 16, 2005 Share Posted September 16, 2005 Hi gafrost, Thanks for the input. I tried your suggestion, but the script does not pause there, I think because the button is enabled ie the script can see it so continues running. I tried: While Not ControlClick ("Virtual Memory", "", "Button2") Sleep ( 50000 ) Wend as a sort of "whilst the button isn't clicked wait here" but that did not work either. I also gave the following a go: Do Sleep(100) Until ControlCommand ( "Virtual Memory", "", "Button2", "IsEnabled", "") but that didn't do the trick. Is there an "on click" function, or any other suggestions? Cheers Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 16, 2005 Moderators Share Posted September 16, 2005 (edited) $Enabled = ControlCommand ( "Virtual Memory", "", "Button2", "IsEnabled", "")DoSleep(100)Until $Enabled <> 0QuestionDoes the Control ever not exist?When the Control is clicked what happens? Edited September 16, 2005 by ronsrules Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Guest nosfera2 Posted September 16, 2005 Share Posted September 16, 2005 (edited) Hi, No, the control will always exist. Nothing happens once the "set" button (the control in question) is clicked. Exiting out of the "System Properties" does prompt for a reboot, but otherwise nothing else happens. For background info I am trying to automate setting virtual memory on NT4 PC's I rebuild. Here's the script so far: Run('control sysdm.cpl') WinWait("System Properties","") If Not WinActive("System Properties","") Then WinActivate("System Properties","") WinWaitActive("System Properties","") Send("{RIGHT}{ALTDOWN}c{ALTUP}") WinWait("Virtual Memory","") If Not WinActive("Virtual Memory","") Then WinActivate("Virtual Memory","") WinWaitActive("Virtual Memory","") Send("{TAB}") here I want to manually fill in values for the minimum and maximum virtual memory, click on "set" and then exit out of the system properties. Edited September 16, 2005 by nosfera2 Link to comment Share on other sites More sharing options...
BigDod Posted September 16, 2005 Share Posted September 16, 2005 Could you not have Input boxes prompt you for the values and pass them to the required fields. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Guest nosfera2 Posted September 16, 2005 Share Posted September 16, 2005 Yes BigDod, I was thinking of something similar if I could not get an "on click" loop constructed. 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