FMS Posted June 24, 2014 Posted June 24, 2014 thnx melba for the reply, I just looked in to it and your explanation does sounds and seems logical now that you say it. but how to build a "2D" array and get stuff from a list... i realy love autoit but i'm not quit handy whit it.... could you explain some more in little more simple words as finishing touch god created the dutch
Moderators Melba23 Posted June 24, 2014 Moderators Posted June 24, 2014 FMS,It is easier to code it and show you: expandcollapse popup#include "FileSystemMonitor.au3" #include <Date.au3> #include <Array.au3> Global $aFileData[1][2] = [[0, 0]] ; Declare 2D array with a count in the [0][0] element Global $sPath = "C:\1" _FileSysMonSetup(1, $sPath) AdlibRegister("_checkFile", 10000) While 1 _FileSysMonDirEventHandler() Sleep(10) WEnd Func _FileSysMonActionEvent($event_type, $event_id, $event_value) Switch $event_type Case 0 Switch $event_id Case 1 ; Add file to array $aFileData[0][0] += 1 ; Increase count ; ReDim the array ReDim $aFileData[$aFileData[0][0] + 1][UBound($aFileData, 2)] ; Add data for this file $aFileData[$aFileData[0][0]][0] = $event_value ; Only save the filename $aTime = FileGetTime($aFileData[$aFileData[0][0]][0]) $aFileData[$aFileData[0][0]][1] = $aTime[0] & "/" & $aTime[1] & "/" & $aTime[2] & " " & $aTime[3] & ":" & $aTime[4] & ":" & $aTime[5] ; Which means we need to add the path here ConsoleWrite("Adding file: " & $sPath & "\" & $aFileData[$aFileData[0][0]][0] & " - " & $aFileData[$aFileData[0][0]][1] & @CRLF) EndSwitch EndSwitch EndFunc Func _checkFile() ; Loop through the array from the bottom up For $i = $aFileData[0][0] To 1 Step -1 $iSecs = _DateDiff("s", $aFileData[$i][1], _NowCalc()) If $iSecs > 20 Then ; Access the array element containing the filename ConsoleWrite("+Now copying: " & $sPath & "\" & $aFileData[$i][0] & " to" & " C:\2\" & $aFileData[$i][0] & @CRLF) ; Remove the file from the array and reset the count $aFileData[0][0] -= 1 _ArrayDelete($aFileData, $i) EndIf Next _ArrayDisplay($aFileData, "", Default, 8) ; Just for demo to show you the array EndFuncDoes that make it clearer? Please ask if you have any questions. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
FMS Posted June 24, 2014 Posted June 24, 2014 (edited) I got a error code when i run this $aFileData[$aFileData[0][0]][1] = $aTime[0] & "/" & $aTime[1] & "/" & $aTime[2] & " " & $aTime[3] & ":" & $aTime[4] & ":" & $aTime[5] $aFileData[$aFileData[0][0]][1] = $aTime^ ERROR >Exit code: 1 Time: 7.115 also i think because of this error the error display isn't working.... ( i think ) I believe its : $aFileData[$aFileData[0][0]][1] = $aTime[0] & "/" & $aTime[0][0]][1] & "/" & $aTime[0][0]][2] & " " & $aTime[0][0]][3] & ":" & $aTime[4] & ":" & $aTime[0][0]][5] or am i wrong and don't understand it at all Edited June 24, 2014 by FMS as finishing touch god created the dutch
Moderators Melba23 Posted June 24, 2014 Moderators Posted June 24, 2014 FMS,I do not get that error. What is the line above the 3 you posted? If (as I suspect) it is "Subscript used on non-accessible variable" then it means that you are not reading the file time correctly. Let us try something a bit different - change the code to this:$aFileData[$aFileData[0][0]][0] = $event_value ; Only save the filename $aFileData[$aFileData[0][0]][1] = _NowCalc() ; Just set current time <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ; Which means we need to add the path hereThat avoids FileGetTime altogether. And as to your suggested fix:i wrong and don't understand it at allis correct. FileGetTime returns a 1D array, so there is absolutely no point in using 2D syntax. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
FMS Posted June 25, 2014 Posted June 25, 2014 (edited) NICE NICE NICE THNX MELBA!!!!! this works like a charm....... also it makes me a little bit better in autoit thnx for the explanation.... (also the arraydisplay function... i will use this a LOT more in the futher..... ) (din't know this was possible ) ps. indeed it was givin me the responce : "Subscript used on non-accessible variable" Edited June 25, 2014 by FMS as finishing touch god created the dutch
Moderators Melba23 Posted June 25, 2014 Moderators Posted June 25, 2014 FMS,Glad I could help. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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