revtex Posted July 28, 2005 Posted July 28, 2005 Ok, Im a n00b when it comes to this stuff.. still kinda learning.. problem is a have some code that updates my progress bar but the code wont end when I need it to. Also im not even sure if a while loop is the best way to do this. Func CleanSystem() $x = 1 $z = 20 UpdateProgress("Purging temp files.", $z) $i = RunWait("c:\tempfiles\Programs\cleanup\Cleanup.exe /AutoRun") While 1 $p = ProcessExists("Cleanup.exe") If NOT $p = 1 And $x = 1 Then UpdateProgress("Purging temp files.", $z) $x = 2 Sleep(500) ContinueLoop EndIf If NOT $p = 1 And $x = 2 Then UpdateProgress("Purging temp files..", $z) $x = 3 Sleep(500) ContinueLoop EndIf If NOT $p = 1 And $x = 3 Then UpdateProgress("Purging temp files...", $z) $x = 1 Sleep(500) ContinueLoop EndIf If $p = 0 Then ExitLoop WEnd If @error = 1 Then Return 0 Else Return 1 EndIf EndFunc ;==>CleanSystem
GaryFrost Posted July 28, 2005 Posted July 28, 2005 (edited) Try this: Edit: changed the RunWait to Run, would never get a process exists with RunWait Func CleanSystem() $x = 1 $z = 20 UpdateProgress ("Purging temp files.", $z) $i = Run("c:\tempfiles\Programs\cleanup\Cleanup.exe /AutoRun") While ProcessExists("Cleanup.exe") If $x = 1 Then UpdateProgress ("Purging temp files.", $z) $x = 2 Sleep(500) ElseIf $x = 2 Then UpdateProgress ("Purging temp files..", $z) $x = 3 Sleep(500) ElseIf $x = 3 Then UpdateProgress ("Purging temp files...", $z) $x = 1 Sleep(500) EndIf WEnd If @error = 1 Then Return 0 Else Return 1 EndIf EndFunc ;==>CleanSystem Edited July 28, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
revtex Posted July 28, 2005 Author Posted July 28, 2005 Very cool, thank you my friend everything is working great now! looks cleaner now too Try this:Edit: changed the RunWait to Run, would never get a process exists with RunWaitFunc CleanSystem() $x = 1 $z = 20 UpdateProgress ("Purging temp files.", $z) $i = Run("c:\tempfiles\Programs\cleanup\Cleanup.exe /AutoRun") While ProcessExists("Cleanup.exe") If $x = 1 Then UpdateProgress ("Purging temp files.", $z) $x = 2 Sleep(500) ElseIf $x = 2 Then UpdateProgress ("Purging temp files..", $z) $x = 3 Sleep(500) ElseIf $x = 3 Then UpdateProgress ("Purging temp files...", $z) $x = 1 Sleep(500) EndIf WEnd If @error = 1 Then Return 0 Else Return 1 EndIf EndFunc ;==>CleanSystem<{POST_SNAPBACK}>
revtex Posted July 28, 2005 Author Posted July 28, 2005 One more thing.. maybe you can help me on this one too.. I have a func that copies files to a temp dir and I want the same effect as the last func.. how does one track the progess of the func DirCopy()? Func InstallFiles() UpdateProgress("Installing program files...", "10") $i = DirCopy(".\files\", "c:\tempfiles", 1) If @error Or $i = 0 Then Return 0 Exit Else Return 1 EndIf EndFunc ;==>InstallFiles
GaryFrost Posted July 28, 2005 Posted July 28, 2005 I guess you wouldn't with dircopy, it won't return till the function is done. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
GaryFrost Posted July 28, 2005 Posted July 28, 2005 Look at this post for copying dirs:#78614 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
revtex Posted July 28, 2005 Author Posted July 28, 2005 perfect! Just what I was looking for BTW... after you changed it to Run() its not reporting in @error, like if I change Cleaning.exe to Clleaning.exe.. it should report 1 but it keeps returning 0 and RunErrorsFatal is set to 0Look at this post for copying dirs:#78614<{POST_SNAPBACK}>
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