Queener Posted July 11, 2013 Share Posted July 11, 2013 (edited) This codes work, but was wondering if there's any better way to write it shorter or (a better code)? Second question is - is it possible to have it check .log on sub folders on desktop as well? $filetype = @DesktopDir & "\*.log" Deleteit() Func Deleteit() if FileExists($filetype) Then FileDelete($filetype) Gowait() Else Gowait() EndIf EndFunc Func Gowait() sleep(60000) Deleteit() EndFunc Edited July 11, 2013 by asianqueen Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.") Link to comment Share on other sites More sharing options...
JohnOne Posted July 11, 2013 Share Posted July 11, 2013 (edited) AdlibRegister("Deleteit", 60000) While Sleep(1000) Wend Func Deleteit() if FileExists($filetype) Then FileDelete($filetype) EndIf EndFunc Edited July 11, 2013 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
czardas Posted July 11, 2013 Share Posted July 11, 2013 (edited) JohnOne - where did you get that from? While Sleep(1000) I know why it works, but I never saw anyone use it before. It reads a little odd. I would have written: ; While 1 Sleep(1000) Wend ; @asianqueen >This UDF might be useful to you. Edited July 11, 2013 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Terenz Posted July 11, 2013 Share Posted July 11, 2013 (edited) czardas, In While...Wend can be used an expression instead of 1 or other numeric value, like: While ProcessExists($Process) ;etc. While $var = 1 ;etc. While @MIN <> 42 ;etc Edited July 11, 2013 by Terenz Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
JohnOne Posted July 11, 2013 Share Posted July 11, 2013 JohnOne - where did you get that from? While Sleep(1000) I know why it works, but I never saw anyone use it before. It reads a little odd. I would have written: ; While 1 Sleep(1000) Wend ; @asianqueen >This UDF might be useful to you. I don't know to be honest, I think it equates to 1, but I imagine if Sleep() fails for some reason, the loop will exit, so probably not recommended really. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
czardas Posted July 12, 2013 Share Posted July 12, 2013 (edited) I don't know to be honest, I think it equates to 1, but I imagine if Sleep() fails for some reason, the loop will exit, so probably not recommended really. Cool idea, but I think it's a bit confusing for a beginner. Of course anything non-zero (or boolean True) should work. Edited July 12, 2013 by czardas operator64 ArrayWorkshop 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