kjcdude Posted December 6, 2007 Share Posted December 6, 2007 I don't know how to use while properly, and the problem im running into is when the window that it's searching for is never executed and it never closes the windows like it should. Thanks expandcollapse popupOpt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) $delayrand = random(1000, 5000) run("C:\Program Files\123\123.exe -localconfig sal -localprog saldll.dll") sleep($delayrand) sleep($delayrand) While 1 If WinExists("ERROR","123.exe (main exce") Then WinActivate("ERROR","123.exe (main exce") WinWaitActive("ERROR","123.exe (main exce") Send("{ENTER}") ProcessClose("123.exe") sleep($delayrand) FileDelete("C:\Program Files\123\ClientRegistry.blob") sleep($delayrand) run("C:\Program Files\123\123.exe -localconfig sal -localprog saldll.dll") sleep($delayrand) EndIf WEnd While 2 If WinExists("123 - Warning","") Then WinClose("123 - Warning","") ProcessClose("123.exe") sleep($delayrand) run("C:\Program Files\123\123.exe -localconfig sal -localprog saldll.dll") sleep($delayrand) EndIf WEnd While 3 If WinExists("CAC","Unable to connect to") Then WinActivate("CAC","Unable to connect to") WinWaitActive("CAC","Unable to connect to") MouseMove(197,17) MouseDown("left") MouseUp("left") MouseMove(201,224) MouseDown("left") MouseUp("left") WinWait("CAC"," 123 for centers") If Not WinActive("CAC"," 123 for centers") Then WinActivate("CAC"," 123 for centers") WinWaitActive("CAC"," 123 for centers") MouseDown("left") MouseUp("left") WinWait("CAC","An Unknown Error has") If Not WinActive("CAC","An Unknown Error has") Then WinActivate("CAC","An Unknown Error has") WinWaitActive("CAC","An Unknown Error has") MouseDown("left") MouseUp("left") sleep($delayrand) if ProcessExists ("123.exe") then ProcessClose("123.exe") EndIf sleep($delayrand) FileCopy("\\smart00\Public\Update System\Updates\Actual Files\123\cac.cfg", "C:\Program Files\123", 1) FileCopy("\\smart00\Public\Update System\Updates\Actual Files\123\sasClient.cfg", "C:\Program Files\123", 1) run("C:\Program Files\123\123.exe -localconfig sal -localprog saldll.dll") sleep($delayrand) EndIf WEnd While 4 WinWait("123 - hostcenterpc","") Do Local $Wait = WinGetState("123 - hostcenterpc","") Sleep(10) Until BitAND($Wait, 2) WinActivate("123 - hostcenterpc","") WinClose("123 - hostcenterpc","") ProcessClose("123.exe") ExitLoop WEnd Link to comment Share on other sites More sharing options...
DW1 Posted December 6, 2007 Share Posted December 6, 2007 While 1 or While 2 or While (anynumber) will always be true, since a number will always = itself. In this case you would never exit that first loop, it will just keep running the code in While 1. To leave that loop you could call ExitLoop AutoIt3 Online Help Link to comment Share on other sites More sharing options...
DW1 Posted December 6, 2007 Share Posted December 6, 2007 The help file says it better than I do. Try that AutoIt3 Online Help Link to comment Share on other sites More sharing options...
kjcdude Posted December 6, 2007 Author Share Posted December 6, 2007 That's what i thought, so basically i need to figure out a way to run all 4 at the same time. Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 6, 2007 Share Posted December 6, 2007 That's what i thought, so basically i need to figure out a way to run all 4 at the same time. Try it this way: While 1 Select Case WinExists("ERROR", "123.exe (main exce") ; Do stuff Case WinExists("123 - Warning", "") ; Do stuff Case WinExists("CAC", "Unable to connect to") ; Do stuff Case WinWait("123 - hostcenterpc", "") ; Do stuff EndSelect Sleep(20) WEnd This will scan continuously for those Case conditions and execute only the code you put in "Do stuff" when the Case is true. You need to keep "Do stuff" as short as possible because while it's executing that it's NOT scanning for the others. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
kjcdude Posted December 6, 2007 Author Share Posted December 6, 2007 That worked just like i needed it to. Thanks 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