Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/03/2011 in all areas

  1. 1 point
  2. Insert GUISwitch($Form1) after GUICtrlDelete ($Pic1)
    1 point
  3. tomashen, You might like to read the GUIRegisterMsg tutorial in the Wiki if you want to learn more about how to intercept messages sent by your GUI. M23 P.S. And a lot fewer emoticons in future please!
    1 point
  4. You could also write it like this. $var1 = ClipGet() $var2 = StringLeft($var1, 4) Switch $var2 Case "BOB1", "BOB2", "BOB3" MsgBox(0, "It is Bob", "It is Bob" ) Case Else MsgBox(0, "Not Bob", "Not Bob" ) EndSwitch
    1 point
  5. silver217, I am not debugging that code - it is incomplete and I hate debugging recursive calls to FileFindFirst/NextFile. Please read the Recursion tutorial in the Wiki to see why - and to find out a better way to do it. Here is a function I just threw together using my RecFileListToArray UDF (look in my sig for the link). I have tested it a few times and it seems to work fine: #include <RecfileListToArray.au3> #include <Array.au3> ; Set the root path $sRoot = "N:Sizer" ; Get a list of files including in subdirs with full path $aFileList = _RecFileListToArray($sRoot, "*", 1, 1, 0, 2) ; Now create an array of the filetimes and fill it Global $aTimes[$aFileList[0] + 1] = [$aFileList[0]] For $i = 1 To $aFileList[0] $aTimes[$i] = Number(FileGetTime($aFileList[$i], 0, 1)) Next ; Just for testing _ArrayDisplay($aFileList, "Start") _ArrayDisplay($aTimes, "Start") ; This is the folder size at the start MsgBox(0, "Initial Size", DirGetSize($sRoot)) ; Set a suitable size here While DirGetSize($sRoot) > 20000000 ; Reset the initial values $iOldest = 99999999999999 $sOldest = "" $iIndex = 0 ; Now go through the times to find the oldest For $i = 1 To $aTimes[0] If $aTimes[$i] < $iOldest Then $iOldest = $aTimes[$i] $sOldest = $aFileList[$i] $iIndex = $i EndIf Next ; And delete the file FileDelete($sOldest) ; Make sure it has gone Do Sleep(10) Until Not FileExists($sOldest) ; And remove it from the arrays _ArrayDelete($aFileList, $iIndex) $aFileList[0] -= 1 _ArrayDelete($aTimes, $iIndex) $aTimes[0] -= 1 ; Just to check _ArrayDisplay($aFileList, "In loop") WEnd ; And this is the folder size at the end MsgBox(0, "Final Size", DirGetSize($sRoot))It should not be too hard to amend it to fit your script, but do come back if you run into problems. M23
    1 point
×
×
  • Create New...