Jump to content
Sign in to follow this  
Fr33b0w

Checks for mp3 and then move it by the genre

Recommended Posts

Fr33b0w

I have done scripts here and there, most of them basic ones, some were good because I did asked for help in here. Before I start next one I would ask for a tip how to do it...

I would like to give a path like:

1) Input a path D:\mp3\2010\2010-07-10\

2) Make script check every folder in that path and if there is mp3 in checked folder to also check for empty folder which will contain genre and it has delimiters like this: info-size-genre-year-quality.

3) I would like to make script to pick up genre info and also "2010-07-10" which i would use to make new folder and MOVE FOLDER which contains empty folder with additional info to a new made one.

What I think I cant do is:

a) dont know how to make script check every folder for mp3

b ) dont know how to move that folder along with all files inside and that empty folder which contains info (or maybe I do just dont know how script will check for mp3s in every folder). I know commands but the way how it would check folders matters to me...

c) i think i will be having problems picking up genre name. i would set delimiters "-" and then pick up array[3] as info for a new folder but dont know how to set it to check that in every different folder. That info folder would also be a LAST folder. No future folders should exist if some folder contain mp3 except that empty one with the info.

d) i would like to move all folders that contain mp3 in, for example, path like this: E:\mp3\genre\date\ and all that from info i get from folders. i think that would not be the problem at all. Also I might try to get genre from last mp3 file in a folder using mp3 udf... That way should be much more simple then to try to get it from "info folder" and I guess not every folder with mp3s have "info folder"...

Any ideas, help, suggestions? I think this one dont need to be big script and I guess idea would be very useful to many people which have mp3s in their collection...

Edited by Fr33b0w

Share this post


Link to post
Share on other sites
Fr33b0w

Fr33b0w,

Take a look at this topic, it's a UDF for reading and writing ID3 tags.

James

I have been trough that... my main problem is how to search every dir that exist from given path, and if it contain mp3 to send it to specific made folder. So... how should I make that little part where it search dir after a dir and if it finds mp3 in it to move it to c:\ for example... I will manage to write other code I hope... Thanks for Your answer James.

Share this post


Link to post
Share on other sites
James

Check out _FileListToArray() it will get every file in a directory. A recursive file search is really what you're after.

You take every file into an array (with the correct file extension), and then loop through it using the ID3 UDF to read the tags. Once every file in the folder has been read, move to the next folder.

I might write an example when I get home.

James

Share this post


Link to post
Share on other sites
Fr33b0w

Check out _FileListToArray() it will get every file in a directory. A recursive file search is really what you're after.

You take every file into an array (with the correct file extension), and then loop through it using the ID3 UDF to read the tags. Once every file in the folder has been read, move to the next folder.

I might write an example when I get home.

James

Hey thanks a lot. I hope I will manage to do something. I have a point where to start. Thanks!

Share this post


Link to post
Share on other sites
Melba23

Fr33b0w,

You can get the Genre (and lots of other info) from a file like this: :blink:

Func Read_Genre_Info($sPassed_File_Name)

    Local $sGenre, $iError

    Local $sDir_Name = StringRegExpReplace($sPassed_File_Name, "(^.*\\)(.*)", "\1")
    Local $sFile_Name = StringRegExpReplace($sPassed_File_Name, "^.*\\", "")
    Local $sDOS_Dir = FileGetShortName($sDir_Name, 1)
    Local $oShellApp = ObjCreate("shell.application")
    If IsObj($oShellApp) Then
        Local $oDir = $oShellApp.NameSpace($sDOS_Dir)
        If IsObj($oDir) Then
            Local $oFile = $oDir.Parsename($sFile_Name)
            If IsObj($oFile) Then
                If @OSVersion = "WIN_VISTA" Or @OSVersion = "WIN_7" Then
                    $sGenre = $oDir.GetDetailsOf($oFile, 16) ; Genre
                ElseIf @OSVersion = "WIN_XP" Then
                    $sGenre = $oDir.GetDetailsOf($oFile, 20) ; Genre
                Else
                    $sGenre = "No Genre Info Available - Unsupported OS"
                EndIf
            Else
                $iError = 3
            EndIf
        Else
            $iError = 2
        EndIf
    Else
        $iError = 1
    EndIf
    If $iError > 0 Then $sGenre = "Could not read File Properties - Error " & $iError
    Return $sGenre

EndFunc   ;==>Read_Genre_Info

M23

P.S. The latest version of my recursive file list to array UDF is here:

#include-once

;#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

; #INDEX# =======================================================================================================================
; Title .........: _RecFileListToArray
; AutoIt Version : v3.3.1.1 or higher
; Language ......: English
; Description ...: Lists files and\or folders in a specified path with optional recursion and sort.
; Remarks .......:
; Note ..........:
; Author(s) .....: Melba23
; Remark ........: Modified Array.au3 functions - credit: Jos van der Zande, LazyCoder, Tylo, Ultima, SolidSnake and gcriaco
; ===============================================================================================================================

; #CURRENT# =====================================================================================================================
; _RecFileListToArray: Lists files and\or folders in a specified path with optional recursion and sort.
; ===============================================================================================================================

; #INTERNAL_USE_ONLY#============================================================================================================
; _RFLTA_AddFileLists ....; Add element to list which is resized if necessary
; _RFLTA_AddToList .......; Add internal arrays after resizing and optional sorting
; _RFLTA_ArraySearch .....; Search array for partial match
; _RFLTA_ArraySort .......; Wrapper for QuickSort function
; _RFLTA_QuickSort .......: Recursive array sort
; _RFLTA_ArrayConcatenate : Join 2 arrays
; _RFLTA_ArrayInsert .....: Insert element into array
; ===============================================================================================================================

; #FUNCTION# ====================================================================================================================
; Name...........: _RecFileListToArray
; Description ...: Lists files and\or folders in a specified path with optional recursion and sort.  Compatible with existing _FileListToArray syntax
; Syntax.........: _RecFileListToArray($sPath[, $sInclude_List = "*"[, $iReturn = 0[, $fRecur = 0[, $fSort = 0[, $sReturnPath = 1[, $sExclude_List = ""]]]]]])
; Parameters ....: $sPath - Initial path used to generate filelist.  If path ends in \ then folders will be returned with an ending \
;                  $sInclude_List - Optional: the filter for included results (default is "*"). Multiple filters must be separated by ";"
;                  $iReturn - Optional: specifies whether to return files, folders or both
;                  |$iReturn = 0 (Default) Return both files and folders
;                  |$iReturn = 1 Return files only
;                  |$iReturn = 2 Return folders only
;                  $fRecur - Optional: specifies whether to search recursively in subfolders
;                  |$fRecur = 0 (Default) Do not search in subfolders
;                  |$fRecur = 1 Search in subfolders
;                  $fSort - Optional: sort ordered in alphabetical and depth order
;                  |$fSort = 0 (Default) Not sorted
;                  |$fSort = 1 Sorted
;                  $sReturnPath - Optional: specifies displayed path of results
;                  |$sReturnPath = 0 File/folder name only
;                  |$sReturnPath = 1 (Default) Initial path not included
;                  |$sReturnPath = 2 Initial path included
;                  $sExclude_List - Optional: the filter for excluded results (default is ""). Multiple filters must be separated by ";"
; Requirement(s).: v3.3.1.1 or higher
; Return values .: Success: One-dimensional array made up as follows:
;                  |$array[0] = Number of Files\Folders returned
;                  |$array[1] = 1st File\Folder
;                  |$array[2] = 2nd File\Folder
;                  |...
;                  |$array[n] = nth File\Folder
;                   Failure: Null string and @error = 1 with @extended set as follows:
;                  |1 = Path not found or invalid
;                  |2 = Invalid $sInclude_List
;                  |3 = Invalid $iReturn
;                  |4 = Invalid $fRecur
;                  |5 = Invalid $fSort
;                  |6 = Invalid $iFullPath
;                  |7 = Invalid $sExclude_List
;                  |8 = No files/folders found
; Author ........: Melba23 using SRE code from forums
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......; Yes
; ===============================================================================================================================
Func _RecFileListToArray($sInitialPath, $sInclude_List = "*", $iReturn = 0, $fRecur = 0, $fSort = 0, $sReturnPath = 1, $sExclude_List = "")

    Local $asReturnList[100] = [0], $asFileMatchList[100] = [0], $asRootFileMatchList[100] = [0], $asFolderMatchList[100] = [0], $asFolderList[100] = [1]
    Local $sFolderSlash = "", $sInclude_List_Mask, $sExclude_List_Mask, $hSearch, $fFolder, $sRetPath = "", $sCurrentPath, $sName

    ; Check valid path
    If Not FileExists($sInitialPath) Then Return SetError(1, 1, "")
    ; Check if folders should have trailing \ and ensure that $sInitialPath does have one
    If StringRight($sInitialPath, 1) = "\" Then
        $sFolderSlash = "\"
    Else
        $sInitialPath = $sInitialPath & "\"
    EndIf
    ; Add path to folder list
    $asFolderList[1] = $sInitialPath

    ; Determine Filter mask for SRE check
    If $sInclude_List = "*" Then
        $sInclude_List_Mask = ".+" ; Set mask to exclude base folder with NULL name
    Else
        If StringRegExp($sInclude_List, "\\|/|:|\<|\>|\|") Then Return SetError(1, 2, "") ; Check For invalid characters within $sInclude_List
        $sInclude_List = StringReplace(StringStripWS(StringRegExpReplace($sInclude_List, "\s*;\s*", ";"), 3), ";", "|") ; Strip WS and insert | for ;
        $sInclude_List_Mask = "(?i)^(" & StringReplace(StringReplace(StringRegExpReplace($sInclude_List, "(\^|\$|\.)", "\\$1"), "?", "."), "*", ".*?") & ")\z" ; Convert to SRE pattern
    EndIf

    ; Determine Exclude mask for SRE check
    If $sExclude_List = "" Then
        $sExclude_List_Mask = ":" ; Set unmatchable mask
    Else
        If StringRegExp($sExclude_List, "\\|/|:|\<|\>|\|") Then Return SetError(1, 7, "") ; Check For invalid characters within $sInclude_List
        $sExclude_List = StringReplace(StringStripWS(StringRegExpReplace($sExclude_List, "\s*;\s*", ";"), 3), ";", "|") ; Strip WS and insert | for ;
        $sExclude_List_Mask = "(?i)^(" & StringReplace(StringReplace(StringRegExpReplace($sExclude_List, "(\^|\$|\.)", "\\$1"), "?", "."), "*", ".*?") & ")\z" ; Convert to SRE pattern
    EndIf

    ; Verify other parameter values
    If Not ($iReturn = 0 Or $iReturn = 1 Or $iReturn = 2) Then Return SetError(1, 3, "")
    If Not ($fRecur = 0 Or $fRecur = 1) Then Return SetError(1, 4, "")
    If Not ($fSort = 0 Or $fSort = 1) Then Return SetError(1, 5, "")
    If Not ($sReturnPath = 0 Or $sReturnPath = 1 Or $sReturnPath = 2) Then Return SetError(1, 6, "")

    ; Search in listed folders
    While $asFolderList[0] > 0

        ; Set path to search
        $sCurrentPath = $asFolderList[$asFolderList[0]]
        ; Reduce folder array count
        $asFolderList[0] -= 1

        ; Determine return path to add to file/folder name
        Switch $sReturnPath
            ; Case 0 ; Name only
            ; Leave as ""
            Case 1 ; Initial path not included
                $sRetPath = StringReplace($sCurrentPath, $sInitialPath, "")
            Case 2 ; Initial path included
                $sRetPath = $sCurrentPath
        EndSwitch

        If $fSort Then

            ; Get folder name
            $sName = StringRegExpReplace(StringReplace($sCurrentPath, $sInitialPath, ""), "(.+?\\)*(.+?)(\\.*?(?!\\))", "$2")

            ; Get search handle
            $hSearch = FileFindFirstFile($sCurrentPath & "*")
            ; If folder empty move to next in list
            If $hSearch = -1 Then ContinueLoop

            ; Search folder
            While 1
                $sName = FileFindNextFile($hSearch)
                ; Check for end of folder
                If @error Then ExitLoop
                ; Check for file - @extended set for subfolder in 3.3.1.1 +
                If @extended Then
                    ; If recursive search, add subfolder to folder list
                    If $fRecur Then _RFLTA_AddToList($asFolderList, $sCurrentPath & $sName & "\")

                    ; Add folder name if matched against Include/Exclude masks
                    If StringRegExp($sName, $sInclude_List_Mask) And Not StringRegExp($sName, $sExclude_List_Mask) Then _
                            _RFLTA_AddToList($asFolderMatchList, $sRetPath & $sName & $sFolderSlash)

                Else
                    ; Add file name if matched against Include/Exclude masks
                    If StringRegExp($sName, $sInclude_List_Mask) And Not StringRegExp($sName, $sExclude_List_Mask) Then
                        If $sCurrentPath = $sInitialPath Then
                            _RFLTA_AddToList($asRootFileMatchList, $sRetPath & $sName)
                        Else
                            _RFLTA_AddToList($asFileMatchList, $sRetPath & $sName)
                        EndIf
                    EndIf
                EndIf
            WEnd

            ; Close current search
            FileClose($hSearch)

        Else ; No sorting required

            ; Get search handle
            $hSearch = FileFindFirstFile($sCurrentPath & "*")
            ; If folder empty move to next in list
            If $hSearch = -1 Then ContinueLoop

            ; Search folder
            While 1
                $sName = FileFindNextFile($hSearch)
                ; Check for end of folder
                If @error Then ExitLoop
                ; Check for subfolder - @extended set in 3.3.1.1 +
                $fFolder = @extended

                ; If recursive search, add subfolder to folder list
                If $fRecur And $fFolder Then _RFLTA_AddToList($asFolderList, $sCurrentPath & $sName & "\")

                ; Check file/folder type against required return value and file/folder name against Include/Exclude masks
                If $fFolder + $iReturn <> 2 And StringRegExp($sName, $sInclude_List_Mask) And Not StringRegExp($sName, $sExclude_List_Mask) Then
                    ; Add final "\" to folders
                    If $fFolder Then $sName &= $sFolderSlash
                    _RFLTA_AddToList($asReturnList, $sRetPath & $sName)
                EndIf
            WEnd

            ; Close current search
            FileClose($hSearch)

        EndIf

    WEnd

    If $fSort Then

        ; Check if any file/folders have been added
        If $asRootFileMatchList[0] = 0 And $asFileMatchList[0] = 0 And $asFolderMatchList[0] = 0 Then Return SetError(1, 8, "")

        Switch $iReturn
            Case 2 ; Folders only
                ; Correctly size folder match list
                ReDim $asFolderMatchList[$asFolderMatchList[0] + 1]
                ; Copy size folder match array
                $asReturnList = $asFolderMatchList
                ; Simple sort list
                _RFLTA_ArraySort($asReturnList)
            Case 1 ; Files only
                If $sReturnPath = 0 Then ; names only so simple sort suffices
                    ; Combine file match lists
                    _RFLTA_AddFileLists($asReturnList, $asRootFileMatchList, $asFileMatchList)
                    ; Simple sort combined file list
                    _RFLTA_ArraySort($asReturnList)
                Else
                    ; Combine sorted file match lists
                    _RFLTA_AddFileLists($asReturnList, $asRootFileMatchList, $asFileMatchList, 1)
                EndIf
            Case 0 ; Both files and folders
                If $sReturnPath = 0 Then ; names only so simple sort suffices
                    ; Combine file match lists
                    _RFLTA_AddFileLists($asReturnList, $asRootFileMatchList, $asFileMatchList)
                    ; Set correct count for folder add
                    $asReturnList[0] += $asFolderMatchList[0]
                    ; Resize and add file match array
                    ReDim $asFolderMatchList[$asFolderMatchList[0] + 1]
                    _RFLTA_ArrayConcatenate($asReturnList, $asFolderMatchList)
                    ; Simple sort final list
                    _RFLTA_ArraySort($asReturnList)
                Else
                    ; Combine sorted file match lists
                    _RFLTA_AddFileLists($asReturnList, $asRootFileMatchList, $asFileMatchList, 1)
                    ; Add folder count
                    $asReturnList[0] += $asFolderMatchList[0]
                    ; Sort folder match list
                    ReDim $asFolderMatchList[$asFolderMatchList[0] + 1]
                    _RFLTA_ArraySort($asFolderMatchList)

                    ; Now add folders in correct place
                    Local $iLastIndex = $asReturnList[0]
                    For $i = $asFolderMatchList[0] To 1 Step -1
                        ; Find first filename containing folder name
                        Local $iIndex = _RFLTA_ArraySearch($asReturnList, $asFolderMatchList[$i])
                        If $iIndex = -1 Then
                            ; Empty folder so insert immediately above previous
                            _RFLTA_ArrayInsert($asReturnList, $iLastIndex, $asFolderMatchList[$i])
                        Else
                            ; Insert folder at correct point above files
                            _RFLTA_ArrayInsert($asReturnList, $iIndex, $asFolderMatchList[$i])
                            $iLastIndex = $iIndex
                        EndIf
                    Next
                EndIf
        EndSwitch

    Else ; No sort

        ; Check if any file/folders have been added
        If $asReturnList[0] = 0 Then Return SetError(1, 8, "")

        ; Remove any unused return list elements from last ReDim
        ReDim $asReturnList[$asReturnList[0] + 1]

    EndIf

    Return $asReturnList

EndFunc   ;==>_RecFileListToArray

; #INTERNAL_USE_ONLY#============================================================================================================
; Name...........: _RFLTA_AddToList
; Description ...: Add element to list which is resized if necessary
; Syntax ........: _RFLTA_AddToList(ByRef $asList, $sValue)
; Parameters ....: $asList - List to be added to
;                  $sValue - Value to add
; Return values .: None - array modified ByRef
; Author ........: Melba23
; Remarks .......: This function is used internally by _RecFileListToArray
; ===============================================================================================================================
Func _RFLTA_AddToList(ByRef $asList, $sValue)

    ; Increase list count
    $asList[0] += 1
    ; Double list size if too small (fewer ReDim needed)
    If UBound($asList) <= $asList[0] Then ReDim $asList[UBound($asList) * 2]
    ; Add value
    $asList[$asList[0]] = $sValue

EndFunc   ;==>_RFLTA_AddToList

; #INTERNAL_USE_ONLY#============================================================================================================
; Name...........: _RFLTA_AddFileLists
; Description ...: Add internal arrays after resizing and optional sorting
; Syntax ........: _RFLTA_AddFileLists(ByRef $asReturnList, $asRootFileMatchList, $asFileMatchList[, $iSort = 0])
; Parameters ....: $asReturnList - Base list
;                  $asRootFileMatchList - First list to add
;                  $asFileMatchList - Second list to add
;                  $iSort - (Optional) Whether to sort lists before adding
;                  |$iSort = 0 (Default) No sort
;                  |$iSort = 1 Sort in descending alphabetical order
; Return values .: None - array modified ByRef
; Author ........: Melba23
; Remarks .......: This function is used internally by _RecFileListToArray
; ===============================================================================================================================
Func _RFLTA_AddFileLists(ByRef $asReturnList, $asRootFileMatchList, $asFileMatchList, $iSort = 0)

    ; Correctly size root file match array
    ReDim $asRootFileMatchList[$asRootFileMatchList[0] + 1]
    ; Simple sort root file match array if required
    If $iSort = 1 Then _RFLTA_ArraySort($asRootFileMatchList)
    ; Copy root file match array
    $asReturnList = $asRootFileMatchList
    ; Add file match count
    $asReturnList[0] += $asFileMatchList[0]
    ; Correctly size file match array
    ReDim $asFileMatchList[$asFileMatchList[0] + 1]
    ; Simple sort file match array if required
    If $iSort = 1 Then _RFLTA_ArraySort($asFileMatchList)
    ; Add file match array
    _RFLTA_ArrayConcatenate($asReturnList, $asFileMatchList)

EndFunc   ;==>_RFLTA_AddFileLists

; #INTERNAL_USE_ONLY#============================================================================================================
; Name...........: _RFLTA_ArraySearch
; Description ...: Search array downwards for partial match
; Syntax ........: _RFLTA_ArraySearch(Const ByRef $avArray, $vValue)
; Parameters ....: $avArray - Array to search
;                  $vValue - PValue to search for
; Return values .: Success: Index of array in which element was found
;                  Failure: returns -1
; Author ........: SolidSnake, gcriaco, Ultima
; Modified.......: Melba23
; Remarks .......: This function is used internally by _RecFileListToArray
; ===============================================================================================================================
Func _RFLTA_ArraySearch(Const ByRef $avArray, $vValue)

    For $i = 1 To UBound($avArray) - 1
        If StringInStr($avArray[$i], $vValue) > 0 Then Return $i
    Next
    Return -1

EndFunc   ;==>_RFLTA_ArraySearch

; #INTERNAL_USE_ONLY#============================================================================================================
; Name...........: _RFLTA_ArraySort
; Description ...: Wrapper for QuickSort function
; Syntax ........: _RFLTA_ArraySort(ByRef $avArray)
; Parameters ....: $avArray - Array to sort
;                  $pNew_WindowProc - Pointer to new WindowProc
; Return values .: None - array modified ByRef
; Author ........: Jos van der Zande, LazyCoder, Tylo, Ultima
; Modified.......: Melba23
; Remarks .......: This function is used internally by _RecFileListToArray
; ===============================================================================================================================
Func _RFLTA_ArraySort(ByRef $avArray)

    Local $iStart = 1, $iEnd = UBound($avArray) - 1
    _RFLTA_QuickSort($avArray, $iStart, $iEnd)

EndFunc   ;==>_RFLTA_ArraySort

; #INTERNAL_USE_ONLY#============================================================================================================
; Name...........: _RFLTA_QuickSort
; Description ...: Recursive array sort
; Syntax ........: _RFLTA_QuickSort(ByRef $avArray, ByRef $iStart, ByRef $iEnd)
; Parameters ....: $avArray - Array to sort in descending alphabetical order
;                  $iStart - Start index
;                  $iEnd - End index
; Return values .: None - array modified ByRef
; Author ........: Jos van der Zande, LazyCoder, Tylo, Ultima
; Modified.......: Melba23
; Remarks .......: This function is used internally by _RFLTA_ArraySort
; ===============================================================================================================================
Func _RFLTA_QuickSort(ByRef $avArray, ByRef $iStart, ByRef $iEnd)

    Local $vTmp
    If ($iEnd - $iStart) < 15 Then
        Local $i, $j, $vCur
        For $i = $iStart + 1 To $iEnd
            $vTmp = $avArray[$i]
            If IsNumber($vTmp) Then
                For $j = $i - 1 To $iStart Step -1
                    $vCur = $avArray[$j]
                    If ($vTmp >= $vCur And IsNumber($vCur)) Or (Not IsNumber($vCur) And StringCompare($vTmp, $vCur) >= 0) Then ExitLoop
                    $avArray[$j + 1] = $vCur
                Next
            Else
                For $j = $i - 1 To $iStart Step -1
                    If (StringCompare($vTmp, $avArray[$j]) >= 0) Then ExitLoop
                    $avArray[$j + 1] = $avArray[$j]
                Next
            EndIf
            $avArray[$j + 1] = $vTmp
        Next
        Return
    EndIf
    Local $L = $iStart, $R = $iEnd, $vPivot = $avArray[Int(($iStart + $iEnd) / 2)], $fNum = IsNumber($vPivot)
    Do
        If $fNum Then
            While ($avArray[$L] < $vPivot And IsNumber($avArray[$L])) Or (Not IsNumber($avArray[$L]) And StringCompare($avArray[$L], $vPivot) < 0)
                $L += 1
            WEnd
            While ($avArray[$R] > $vPivot And IsNumber($avArray[$R])) Or (Not IsNumber($avArray[$R]) And StringCompare($avArray[$R], $vPivot) > 0)
                $R -= 1
            WEnd
        Else
            While (StringCompare($avArray[$L], $vPivot) < 0)
                $L += 1
            WEnd
            While (StringCompare($avArray[$R], $vPivot) > 0)
                $R -= 1
            WEnd
        EndIf
        If $L <= $R Then
            $vTmp = $avArray[$L]
            $avArray[$L] = $avArray[$R]
            $avArray[$R] = $vTmp
            $L += 1
            $R -= 1
        EndIf
    Until $L > $R
    _RFLTA_QuickSort($avArray, $iStart, $R)
    _RFLTA_QuickSort($avArray, $L, $iEnd)

EndFunc   ;==>_RFLTA_QuickSort

; #INTERNAL_USE_ONLY#============================================================================================================
; Name...........: _RFLTA_ArrayConcatenate
; Description ...: Joins 2 arrays
; Syntax ........: _RFLTA_ArrayConcatenate(ByRef $avArrayTarget, Const ByRef $avArraySource)
; Parameters ....: $avArrayTarget - Base array
;                  $avArraySource - Array to add from element 1 onwards
; Return values .: None - array modified ByRef
; Author ........: Ultima
; Modified.......: Melba23
; Remarks .......: This function is used internally by _RecFileListToArray
; ===============================================================================================================================
Func _RFLTA_ArrayConcatenate(ByRef $avArrayTarget, Const ByRef $avArraySource)

    Local $iUBoundTarget = UBound($avArrayTarget) - 1, $iUBoundSource = UBound($avArraySource)
    ReDim $avArrayTarget[$iUBoundTarget + $iUBoundSource]
    For $i = 1 To $iUBoundSource - 1
        $avArrayTarget[$iUBoundTarget + $i] = $avArraySource[$i]
    Next

EndFunc   ;==>_RFLTA_ArrayConcatenate

; #INTERNAL_USE_ONLY#============================================================================================================
; Name...........: _RFLTA_ArrayInsert
; Description ...: Insert element into array
; Syntax ........: _RFLTA_ArrayInsert(ByRef $avArray, $iElement, $vValue = "")
; Parameters ....: $avArray - Array to modify
;                  $iElement - Index position for insertion
;                  $vValue - Value to insert
; Return values .: None - array modified ByRef
; Author ........: Jos van der Zande, Ultima
; Modified.......: Melba23
; Remarks .......: This function is used internally by _RecFileListToArray
; ===============================================================================================================================
Func _RFLTA_ArrayInsert(ByRef $avArray, $iElement, $vValue = "")

    Local $iUBound = UBound($avArray) + 1
    ReDim $avArray[$iUBound]
    For $i = $iUBound - 1 To $iElement + 1 Step -1
        $avArray[$i] = $avArray[$i - 1]
    Next
    $avArray[$iElement] = $vValue

EndFunc   ;==>_RFLTA_ArrayInsert

As the thread JamesBrooks linked to progressed, the SREs used in the UDF were gradually improved (not difficult when I write them initially :P !). This version is the one I use now. ;)


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Fr33b0w

Melba23,

How You have energy for all this? A lot of code... Did try something quick but I will need more time to get all this out of the earth thing. Its great and big just will need time for a novice like me to see all that. But I can see that more then a answer is right there. Thank You!

$sPassed_File_Name should contain path name or? Sorry for taking Your time...

Share this post


Link to post
Share on other sites
Melba23

Fr33b0w,

$sPassed_File_Name should hold the full path of the file.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Fr33b0w

Fr33b0w,

$sPassed_File_Name should hold the full path of the file.

M23

Of the FILE? Not FOLDER? Thanks I will have time tomorrow and try to get it done. There is good stuff You posted to learn from!

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.