Jump to content

A loop delete


Recommended Posts

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 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

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 by czardas
Link to comment
Share on other sites

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

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 by czardas
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...