win2k Posted July 20, 2006 Share Posted July 20, 2006 here is some of my code thus far. BlockInput(1) Dim $i Dim $text ;Declaring the name of the service you are searching for Const $service= "Server" Send("#r") WinWaitActive("Run", "", 1) send("c:\windows\system32\services.msc") sleep(50) send("{enter}") WinWaitActive("services","",1) send("{TAB}") Do send("{ENTER}") sleep(200) send("^C") $text=ClipGet() If $text <> $service Then send("{ESC}") Endif send("{DOWN}") until $text==$service send("+{TAB}") sleep(50) Send("{right}") sleep(50) Send("{tab}") sleep(50) Send("{DOWN}") sleep(50) BlockInput(0) Say for intsance that for some odd reason or another, the "Server" Service was not running and the script just kept running through all the services. Should I encapsulate the Do...Until loop in like a for next loop that just ran twice and upon failure ended the script? BTW is there an end script function ? I know lots of dumb questions today, I am still learning Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 20, 2006 Moderators Share Posted July 20, 2006 End Script Function = Exit 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...
kijer Posted July 20, 2006 Share Posted July 20, 2006 i just kind of skimmed it but i didnt see whuile so idont know how you do loops... but instead of while 1 you could use Dim $C $C = 0 While $C < 2 blah blah blah $C = $C + 1 WEnd or I think there is a timeout thing so it could wait an amount of time. Link to comment Share on other sites More sharing options...
jvanegmond Posted July 20, 2006 Share Posted July 20, 2006 Suggestion: Replace this end("#r") WinWaitActive("Run", "", 1) send("c:\windows\system32\services.msc") sleep(50) send("{enter}") github.com/jvanegmond Link to comment Share on other sites More sharing options...
jvanegmond Posted July 20, 2006 Share Posted July 20, 2006 (edited) Here's a quick fix, with a 30 second timeout. AdlibEnable("MyExit", 30000) Do send("{ENTER}") sleep(200) send("^C") $text=ClipGet() If $text <> $service Then send("{ESC}") Endif send("{DOWN}") until $text==$service Func MyExit() Exit EndFunc Untested Edited July 20, 2006 by Manadar github.com/jvanegmond 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