Jump to content

Help


Recommended Posts

Ok, So I have it delete these bncache.dat files constantly, it works all fine but what its doing is deleting these dat files that are created by Diablo II on creation of a game and while ur still in that game one of the dat files r locked and cannot be deleted... Here's my code and u can see it goes into an endless loop until the dat files r deleted

Func _BNCacheDel()
    $search = FileFindFirstFile($diablopath & "\bncache*.dat")
    Do
        $file = FileFindNextFile($search)
        If Not $file = "" Then
            FileDelete($diablopath & "\" & $file)
            If Not FileExists($diablopath & "\" & $file) Then
                $numofdeletes += 1
            EndIf
        EndIf
    Until $file = ""
EndFunc ;==>_BNCacheDel

And for Timer I have been using

$initialtime = _GetCurrentTimeInSecs()

Func _GetCurrentTimeInSecs()
    Local $days = @YDAY / 24
    Local $hours = @HOUR + $days
    Local $mins = $hours * 60
    Local $halfsecs = $mins + @MIN
    Local $secs = $halfsecs * 60
    $currenttime = $secs + @SEC
    Return $currenttime
EndFunc  ;==>_GetCurrentTimeInSecs

Now I just saw somebody use TimerInit() and TimerDifference or sumden like dat... is this the same thing, am I a noob? :)

Edited by tlokz
Link to comment
Share on other sites

Well if it says one of the files are locked or cant be deleted i wouldn't touch them lol. But i added some error checking with the first bit of code you have:

Func _BNCacheDel()
    $search = FileFindFirstFile($diablopath & "\bncache*.dat")
    If $search = @error Then MsgBox(4112, "ERROR!", "An error occured finding the first file!")
        WinActivate("Diablo II")
    Do
        $file = FileFindNextFile($search)
        If $file = @error Then MsgBox(4112, "ERROR!", "An error occured finding the next file!")
            WinActivate("Diablo II")
        If Not $file = "" Then
            $FileDelete = FileDelete($diablopath & "\" & $file)
            If Not FileExists($diablopath & "\" & $file) Then
                $numofdeletes += 1
            EndIf
        EndIf
        If $FileDelete = @error Or = -1 Or 0
            MsgBox(4112, "Program Error!", "An error has occured deleteing the file, maximizing Diablo, ERROR #:" & @error)
            WinActivate("Diablo II")
    Until $file = ""
EndFunc;==>_BNCacheDel
and the timer is fine, but you could build on this:
$var = TimerInit()

MsgBox(0, "Time", "Time:" & $var)
Hope that helps, Clipper34

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