Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 38

Thread: TestsExplorerWSO

  1. #11
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    Some extra notes for this forum post: https://eileenslounge.com/viewtopic....313578#p313578

    I took a look at this



    Here is the test file and folder details https://i.postimg.cc/pX90bM2Q/MM-Pro...est-Folder.jpg https://i.postimg.cc/2SN78v0H/MM-Pro...est-Folder.jpg


    Sample File ___ sample.wmv https://app.box.com/s/leu06ql1fu9uzt59wnoizedg85qoo7k4
    Folder ___ MMPropertyTest https://app.box.com/s/27u7dyjee3rez44pdjq52uu2e7tgzu8v
    File with coding in ___ Movie Maker Versions.xls https://app.box.com/s/axle7nflnmgkfbztto1wsmhc2ml2ynes
    ' c009 Built in VBA FileLen( ) way , ' c109 Scripting Runtime Object Library way
    Code:
    Sub SumSnbs_() '         http://www.eileenslounge.com/viewtopic.php?p=313578#p313578     https://www.snb-vba.eu/VBA_Bestanden.html#L_2.17
    Dim FileThing As Variant, FolderThing As Variant, FlFldrNme As String
    '  c009   Built in  VBA FileLen( )  way
     Let FlFldrNme = Dir(PathName:=ThisWorkbook.Path & Application.PathSeparator & "*", Attributes:=vbDirectory + vbNormal)
        Do While Left(FlFldrNme, 1) = "."    '    https://www.accessforums.net/showthread.php?t=60879&p=325335#post325335
         Let FlFldrNme = Dir
        Loop '  While Left(FlFldrNme, 1) = "."
        Do While FlFldrNme <> ""
        Debug.Print FlFldrNme & "     ";
         Let FileThing = FileLen(ThisWorkbook.Path & "\" & FlFldrNme) '  VBA built in way
            If FileThing = 0 Then  '  Probably got a Folder
            '  c109    Scripting Runtime Object Library  way
             Let FolderThing = CreateObject("scripting.filesystemobject").GetFolder(ThisWorkbook.Path & "\" & FlFldrNme).Size
             Debug.Print FolderThing
            Else  '  Probably got a file
             Debug.Print FileThing & "     "; '  VBA built in way
             Let FileThing = CreateObject("scripting.filesystemobject").GetFile(ThisWorkbook.Path & "\" & FlFldrNme).Size
             Debug.Print FileThing            '  c109    Scripting Runtime Object Library  way
            End If
         Let FlFldrNme = Dir
        Loop ' While vTemp <> ""
    End Sub
    Results:
    Code:
     sample.wmv     643170      643170 
    Microsoft Scripting Runtime  Library referrence.JPG     96231      96231 
    snbsize.JPG     96857      96857 
    Windows Script Host Object Model  Library referrence.JPG     85009      85009 
    MySubFolder      96857 
    Movie Maker Versions.xls     1630720      1630720
    Conclusions:
    Both the in-built VBA file size function and the file size from scripting file system object appear to give a nice Bytes size number
    The folder size from the scripting file system object gives a similar number. (Note that in the folder, MySubFolder, is a single file, snbsize.JPG, and I also ran the code with nothing in MySubFolder and got a size of 0. So it would appear that an empty folder has a size of the things in it.




    ' c309 Microsoft Shell Controls And Automation way

    Code:
    Sub MicrosoftShellControlsAndAutomation() '  referrence  Microsoft Shell Controls And Automation     https://i.postimg.cc/Fz9zrnNm/Tools-Referrences-Microsoft-Shell-Controls-And-Automation.jpg     https://i.postimg.cc/sDC9S54h/Tools-Referrences-Microsoft-Shell-Controls-And-Automation.jpg
    '  c309  Microsoft Shell Controls And Automation   way
    Dim oShell As Shell32.Shell: Set oShell = New Shell32.Shell
     Dim Itm As Shell32.FolderItem, objFolder As Shell32.Folder: Set objFolder = oShell.Namespace(ThisWorkbook.Path)
        For Each Itm In objFolder.Items
         Debug.Print Itm.Name & "   " & Itm.Size & "   " & objFolder.GetDetailsOf(Itm, 1)
        Next Itm
    End Sub
    Results:
    Code:
     sample.wmv   643170   628 KB
    Microsoft Scripting Runtime  Library referrence.JPG   96231   93,9 KB
    snbsize.JPG   96857   94,5 KB
    Windows Script Host Object Model  Library referrence.JPG   85009   83,0 KB
    MySubFolder   0   
    Movie Maker Versions.xls   1630720   1,55 MB
    Conclusion:
    The .size and .GetDetailsOf(Itm, 1) seem to give different numbers and the .size looks like the nice number
    It seems to be broken for a folder. The .size gives 0 and the .GetDetailsOf(Itm, 1) gives nothing




    ' c709 VBA Open For Input Close way

    Code:
    '   c709    VBA  Open For Input  Close    way
    Sub c709() '  https://www.snb-vba.eu/VBA_Bestanden.html#L_2.17    Size: file size / file length in bytes
    Dim vTemp As Variant
    Open ThisWorkbook.Path & "\" & "sample.wmv" For Input As #1
     Let vTemp = LOF(1): Debug.Print vTemp '  643170
    Close
    
    'Open ThisWorkbook.Path & "\" & "MySubFolder" For Input As #1    '  Does not work for Folders
    ' Let vTemp = LOF(1): Debug.Print vTemp
    'Close
    End Sub
    Result:
    643170
    Conclusions
    For a file, this returns the nice Byte number. (It does not work for a folder)




    The final way suggested by snb, the Windows Script Host Object Model look like it needs some more consideration, so I will look at that in the next post, https://www.excelfox.com/forum/showt...ll=1#post23918

  2. #12
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    ' c509 c609 Windows Script Host Object Model

    This does not initially seem to be doing what it was supposed to. It’s not giving any properties. For the case of a file it returns a simple string of that file. For the case of a folder it lists all in the folder

    Code:
    ' c509    c609   Windows Script Host Object Model
    Sub WindowsScriptHostObjectModel()  '        referrence  Windows Script Host Object Model              https://i.postimg.cc/k5FnwWrH/Windows-Script-Host-Object-Model-Library-referrence.jpg
    Dim wsh As WshShell: Set wsh = New WshShell
    Dim CmdString As String: Let CmdString = "cmd /c Dir " & Chr(34) & ThisWorkbook.Path & "\" & "sample.wmv" & Chr(34) & " /b":    '   Debug.Print CmdString
    Dim vTemp As Variant
     Let vTemp = wsh.Exec(CmdString).StdOut.ReadAll
    ' Call WtchaGot_Unic_NotMuchIfYaChoppedItOff(vTemp)  '  vTemp is  "sample" & "." & "wmv" & vbCr & vbLf
    ' c509    c609
     Let vTemp = CreateObject("wscript.shell").Exec(CmdString).StdOut.ReadAll
    ' Call WtchaGot_Unic_NotMuchIfYaChoppedItOff(vTemp)  '  vTemp is  "sample" & "." & "wmv" & vbCr & vbLf
     Let vTemp = Split(vTemp, vbCr & vbLf)  '   Watch : - : vTemp :  : Variant/String(0 to 1) : Tabelle4.WindowsScriptHostObjectModel   https://i.postimg.cc/JhWrbPFJ/Split-v-Temp-vb-Cr-vb-Lf.jpg
    End Sub
    Sub WindowsScriptHostObjectModel_()   '        referrence  Windows Script Host Object Model              https://i.postimg.cc/k5FnwWrH/Windows-Script-Host-Object-Model-Library-referrence.jpg
    Dim FlFldrNme As String, vTemp As Variant
      Let FlFldrNme = Dir(PathName:=ThisWorkbook.Path & Application.PathSeparator & "*", Attributes:=vbDirectory + vbNormal)
        Do While Left(FlFldrNme, 1) = "."    '    https://www.accessforums.net/showthread.php?t=60879&p=325335#post325335
         Let FlFldrNme = Dir
        Loop '  While Left(FlFldrNme, 1) = "."
    ' a) Loop through all files and folders in the main folder in the Command line string
        Do While FlFldrNme <> ""
        Debug.Print FlFldrNme & vbCr & vbLf
        ' c509    c609
         Dim CmdString As String: Let CmdString = "cmd /c Dir " & Chr(34) & ThisWorkbook.Path & "\" & FlFldrNme & Chr(34) & " /b"    '   : Debug.Print CmdString
         Let vTemp = CreateObject("wscript.shell").Exec(CmdString).StdOut.ReadAll
         'Call WtchaGot_Unic_NotMuchIfYaChoppedItOff(vTemp)  '  vTemp is  "sample" & "." & "wmv" & vbCr & vbLf
         Debug.Print vTemp
         Let FlFldrNme = Dir
        Loop ' While vTemp <> ""
    
    Debug.Print: Debug.Print
    ' b) use the main folder in the Command line string
     Let CmdString = "cmd /c Dir " & Chr(34) & ThisWorkbook.Path & Chr(34) & " /b"     '   : Debug.Print CmdString
     Let vTemp = CreateObject("wscript.shell").Exec(CmdString).StdOut.ReadAll
    'Call WtchaGot_Unic_NotMuchIfYaChoppedItOff(vTemp)  '  vTemp is  "sample" & "." & "wmv" & vbCr & vbLf
     Debug.Print vTemp
    End Sub
    Results ' a) (Sub WindowsScriptHostObjectModel_() )
    Code:
     sample.wmv
    
    sample.wmv
    
    Microsoft Scripting Runtime  Library referrence.JPG
    
    Microsoft Scripting Runtime  Library referrence.JPG
    
    snbsize.JPG
    
    snbsize.JPG
    
    Windows Script Host Object Model  Library referrence.JPG
    
    Windows Script Host Object Model  Library referrence.JPG
    
    MySubFolder
    
    snbsize.JPG
    
    Movie Maker Versions.xls
    
    Movie Maker Versions.xls
    For the case of a file it returns a simple string of that file. For the case of a folder it lists all in the folder




    Results ' b) (Sub WindowsScriptHostObjectModel_() )
    Code:
     sample.wmv
    Microsoft Scripting Runtime  Library referrence.JPG
    snbsize.JPG
    Windows Script Host Object Model  Library referrence.JPG
    MySubFolder
    Movie Maker Versions.xls
    For the case of the main folder, all the files and folders in the main folder are listed








    folder details https://i.postimg.cc/pX90bM2Q/MM-Pro...est-Folder.jpg https://i.postimg.cc/2SN78v0H/MM-Pro...est-Folder.jpg


    Sample File ___ sample.wmv https://app.box.com/s/leu06ql1fu9uzt59wnoizedg85qoo7k4
    Folder ___ MMPropertyTest https://app.box.com/s/27u7dyjee3rez44pdjq52uu2e7tgzu8v
    File with coding in ___ Movie Maker Versions.xls https://app.box.com/s/axle7nflnmgkfbztto1wsmhc2ml2ynes

  3. #13

  4. #14
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    Some more notes for these main forum posts
    https://eileenslounge.com/viewtopic....313622#p313622
    https://www.excelfox.com/forum/showt...age2#post23776


    https://i.postimg.cc/SQLdw105/Version-2-Files.jpg


    The basic coding to get the initial results as shown above
    What looked potentially a useful coding way I got from this good source, https://www.youtube.com/watch?v=jTmVtPHtiTg . Summarised, the coding there treats things, (I think probably everything, Folders and files), in a folder as Items of that folder. You loop through those items, and are able to get a lot of properties for each one. Each property is returned from a code line of this general form PropertyValue = objFolder.GetDetailsOf(Fil, 166) (For want of a better descriptions I will refer to this as the windows shell object way)

    The basic looping structure would then be of this sort of form
    Dim objShell As Shell32.Shell: Set objShell = New Shell32.Shell ' https://i.postimg.cc/fz9zrnnm/tools-referrences-microsoft-shell-controls-and-automation.jpg https://i.postimg.cc/sdc9s54h/tools-...automation.jpg
    Dim objFolder As Shell32.Folder: Set objFolder = objShell.Namespace(FullPathToFolder) '
    Dim Fil As Shell32.FolderItem

    __For Each Fil In objFolder.Items
    ___PropertyValue = objFolder.GetDetailsOf(Fil, 166)

    __Next Fil

    So , briefly, Fil is declared as a folder Item, and we loop through each of them in the folder. At each loop we can get a particular property from a number. In that example I have 166, which so far always seems to give me a version number.
    To get the full listing of the numbers for the different properties available, see here https://www.youtube.com/watch?v=jTmVtPHtiTg&t=560s
    https://www.youtube.com/watch?v=jTmV...8sZ9zYqog9KZ5B
    https://www.youtube.com/watch?v=jTmV...UOM9zYlZPKdOpm


    Full coding example
    As time went on, I chopped and changed the basic coding quite a bit to suit getting a better comparison of the Movie Maker folder contents. So this is just one early working example. The example is for the earliest version of Movie Maker that I could find, version 2
    In the uploaded workbook , Movie Maker Versions.xls , the coding given in this and the next post are towards the top of Worksheets Version 2 code module
    Initially I did 2 macros. The first, below analyses the main Movie Maker Folder. It makes 2 columns, the first gives the property names and in the second column it attempts to give the properties.
    The Movie Maker main program folder is also uploaded.
    Basically the macro loops through all items in the same folder as you put the Excel file containing the macro, Movie Maker Versions.xls. There is a Stop in the coding, so that you can resume if necessary until you hit the Movie Maker

    Select top left where you want the results to start, and run Sub Schell2ColumnMovieMakerFolderDetails()

    For example I selected cell A3 and ran the macro Sub Schell2ColumnMovieMakerFolderDetails()


    https://i.postimg.cc/ZRR7ZRBz/Versio...r-analysis.jpg
    Attachment 5727



    Code:
    ' Select top left of where Folder details should start. Folder details will be for all items that are in the Folder at the   Parf  string  There is a  Stop  so you can resume until you get the Movie Maker folder
    Private Sub Schell2ColumnMovieMakerFolderDetails()    '    https://www.youtube.com/watch?v=jTmVtPHtiTg&t=612s
    Dim Ws As Worksheet: Set Ws = Me
    '                    Windows (Live) Movie Maker        archive org details wmm2installer\Jewano Install Dec 5 2023
    Dim Parf As String
    Let Parf = ThisWorkbook.Path '  To test coding, put the  Movie Maker  main programs folder
    Dim objShell As Shell32.Shell: Set objShell = New Shell32.Shell  '    https://i.postimg.cc/Fz9zrnNm/Tools-Referrences-Microsoft-Shell-Controls-And-Automation.jpg     https://i.postimg.cc/sDC9S54h/Tools-Referrences-Microsoft-Shell-Controls-And-Automation.jpg
    Dim ObjFolder As Shell32.Folder: Set ObjFolder = objShell.Namespace(Parf)
    Dim Fil As Shell32.FolderItem
        For Each Fil In ObjFolder.Items
        Dim Rw As Long: Let Rw = 1 ': Let Rw = Rw + 1
         Let ActiveCell.Offset(Rw, 0) = "Name": Let ActiveCell.Offset(Rw, 1) = ObjFolder.GetDetailsOf(Fil, 0)
         ' Or to check the property name
         Let ActiveCell.Offset(Rw, 0) = ObjFolder.GetDetailsOf("Anything", 0): Let ActiveCell.Offset(Rw, 1) = ObjFolder.GetDetailsOf(Fil, 0)
         Let ActiveCell.Offset(Rw + 1, 0) = "Größe": Let ActiveCell.Offset(Rw + 1, 1) = ObjFolder.GetDetailsOf(Fil, 1)
         Let ActiveCell.Offset(Rw + 2, 0) = "Elementtyp": Let ActiveCell.Offset(Rw + 2, 1) = ObjFolder.GetDetailsOf(Fil, 2)
         Let ActiveCell.Offset(Rw + 3, 0) = "Änderungsdatum": Let ActiveCell.Offset(Rw + 3, 1) = Left(ObjFolder.GetDetailsOf(Fil, 3), InStr(1, ObjFolder.GetDetailsOf(Fil, 3), " ", vbBinaryCompare))
         Let ActiveCell.Offset(Rw + 4, 0) = "Erstelldatum": Let ActiveCell.Offset(Rw + 4, 1) = Left(ObjFolder.GetDetailsOf(Fil, 4), InStr(1, ObjFolder.GetDetailsOf(Fil, 4), " ", vbBinaryCompare))
         Let ActiveCell.Offset(Rw + 5, 0) = "Abmessungen": Let ActiveCell.Offset(Rw + 5, 1) = ObjFolder.GetDetailsOf(Fil, 31)
         Let ActiveCell.Offset(Rw + 6, 0) = "Gesamtgröße": Let ActiveCell.Offset(Rw + 6, 1) = ObjFolder.GetDetailsOf(Fil, 57)
         Let ActiveCell.Offset(Rw + 7, 0) = "Dateierweiterung": Let ActiveCell.Offset(Rw + 7, 1) = ObjFolder.GetDetailsOf(Fil, 164)
         Let ActiveCell.Offset(Rw + 8, 0) = "Dateiname": Let ActiveCell.Offset(Rw + 8, 1) = ObjFolder.GetDetailsOf(Fil, 165)
         Let ActiveCell.Offset(Rw + 9, 0) = "Dateiversion": Let ActiveCell.Offset(Rw + 9, 1) = ObjFolder.GetDetailsOf(Fil, 166)
         Let ActiveCell.Offset(Rw + 10, 0) = "Gesamtdateigröße": Let ActiveCell.Offset(Rw + 10, 1) = ObjFolder.GetDetailsOf(Fil, 309)
         Let ActiveCell.Offset(Rw + 11, 0) = "Videokomprimierung": Let ActiveCell.Offset(Rw + 11, 1) = ObjFolder.GetDetailsOf(Fil, 311)
         Let ActiveCell.Offset(Rw + 12, 0) = "Regisseure": Let ActiveCell.Offset(Rw + 12, 1) = ObjFolder.GetDetailsOf(Fil, 312)
         Let ActiveCell.Offset(Rw + 13, 0) = "Datenrate": Let ActiveCell.Offset(Rw + 13, 1) = ObjFolder.GetDetailsOf(Fil, 313)
         Let ActiveCell.Offset(Rw + 14, 0) = "Bildhöhe": Let ActiveCell.Offset(Rw + 14, 1) = ObjFolder.GetDetailsOf(Fil, 314)
         Let ActiveCell.Offset(Rw + 15, 0) = "Einzelbildrate": Let ActiveCell.Offset(Rw + 15, 1) = ObjFolder.GetDetailsOf(Fil, 315)
         Let ActiveCell.Offset(Rw + 16, 0) = "Bildbreite": Let ActiveCell.Offset(Rw + 16, 1) = ObjFolder.GetDetailsOf(Fil, 316)
         Let ActiveCell.Offset(Rw + 17, 0) = "Kugelförmig": Let ActiveCell.Offset(Rw + 17, 1) = ObjFolder.GetDetailsOf(Fil, 317)
         Let ActiveCell.Offset(Rw + 18, 0) = "Stereo": Let ActiveCell.Offset(Rw + 10, 1) = ObjFolder.GetDetailsOf(Fil, 309)
         Let ActiveCell.Offset(Rw + 19, 0) = "Videoausrichtung": Let ActiveCell.Offset(Rw + 19, 1) = ObjFolder.GetDetailsOf(Fil, 319)
         Let ActiveCell.Offset(Rw + 20, 0) = "Gesamtbitrate": Let ActiveCell.Offset(Rw + 20, 1) = ObjFolder.GetDetailsOf(Fil, 320)
        Stop ' In case you got the wrong folder  -  keep hitting  Play button   or  F5  until the folder you want is found
        Next Fil
    End Sub





    Movie Maker https://app.box.com/s/cxvc735a85q6az2r3gtb7ii9w2p3jzpf
    Movie Maker Versions.xls https://app.box.com/s/axle7nflnmgkfbztto1wsmhc2ml2ynes

  5. #15
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    As example, after running the macro in the last post , in the same worksheet, select cell D3 and run the macro below. Details of the file should be added.

    https://i.postimg.cc/g2y0C2qk/Versio...aker-files.jpg
    Attachment 5726


    Code:
    ' Select top left of where File details should start, usually column D
    Private Sub FolderFileDetails()    '    https://www.youtube.com/watch?v=jTmVtPHtiTg&t=612s
    Dim Ws As Worksheet: Set Ws = Me
    Dim Parf As String
     Let Parf = ThisWorkbook.Path & "\Movie Maker"
    Dim objShell As Shell32.Shell: Set objShell = New Shell32.Shell  '    https://i.postimg.cc/Fz9zrnNm/Tools-Referrences-Microsoft-Shell-Controls-And-Automation.jpg     https://i.postimg.cc/sDC9S54h/Tools-Referrences-Microsoft-Shell-Controls-And-Automation.jpg
    Dim ObjFolder As Shell32.Folder: Set ObjFolder = objShell.Namespace(Parf)
    Dim Fil As Shell32.FolderItem
        For Each Fil In ObjFolder.Items
        Dim Clm As Long: Let Clm = Clm + 1
        Dim Rw As Long: Let Rw = 1
         Let ActiveCell.Offset(Rw, Clm - 1) = ObjFolder.GetDetailsOf(Fil, 0)
         Let ActiveCell.Offset(Rw + 1, Clm - 1) = ObjFolder.GetDetailsOf(Fil, 1)
         Let ActiveCell.Offset(Rw + 2, Clm - 1) = Replace(ObjFolder.GetDetailsOf(Fil, 2), "Anwendungserweiterung", "App Ext", 1, 1, vbBinaryCompare)
         Let ActiveCell.Offset(Rw + 3, Clm - 1) = Left(ObjFolder.GetDetailsOf(Fil, 3), InStr(1, ObjFolder.GetDetailsOf(Fil, 3), " ", vbBinaryCompare))
         Let ActiveCell.Offset(Rw + 4, Clm - 1) = Left(ObjFolder.GetDetailsOf(Fil, 4), InStr(1, ObjFolder.GetDetailsOf(Fil, 4), " ", vbBinaryCompare))
         Let ActiveCell.Offset(Rw + 5, Clm - 1) = ObjFolder.GetDetailsOf(Fil, 31)
         Let ActiveCell.Offset(Rw + 6, Clm - 1) = ObjFolder.GetDetailsOf(Fil, 57)
         Let ActiveCell.Offset(Rw + 7, Clm - 1) = ObjFolder.GetDetailsOf(Fil, 164)
         Let ActiveCell.Offset(Rw + 8, Clm - 1) = ObjFolder.GetDetailsOf(Fil, 165)
         Let ActiveCell.Offset(Rw + 9, Clm - 1) = ObjFolder.GetDetailsOf(Fil, 166)
         Let ActiveCell.Offset(Rw + 10, Clm - 1) = ObjFolder.GetDetailsOf(Fil, 309)
         Let ActiveCell.Offset(Rw + 11, Clm - 1) = ObjFolder.GetDetailsOf(Fil, 311)
         Let ActiveCell.Offset(Rw + 12, Clm - 1) = ObjFolder.GetDetailsOf(Fil, 312)
         Let ActiveCell.Offset(Rw + 13, Clm - 1) = ObjFolder.GetDetailsOf(Fil, 313)
         Let ActiveCell.Offset(Rw + 14, Clm - 1) = ObjFolder.GetDetailsOf(Fil, 314)
         Let ActiveCell.Offset(Rw + 15, Clm - 1) = ObjFolder.GetDetailsOf(Fil, 315)
         Let ActiveCell.Offset(Rw + 16, Clm - 1) = ObjFolder.GetDetailsOf(Fil, 316)
         Let ActiveCell.Offset(Rw + 17, Clm - 1) = ObjFolder.GetDetailsOf(Fil, 317)
         Let ActiveCell.Offset(Rw + 18, Clm - 1) = ObjFolder.GetDetailsOf(Fil, 309)
         Let ActiveCell.Offset(Rw + 19, Clm - 1) = ObjFolder.GetDetailsOf(Fil, 319)
         Let ActiveCell.Offset(Rw + 20, Clm - 1) = ObjFolder.GetDetailsOf(Fil, 320)
        'Stop ' Stop after each file
        Next Fil
    End Sub
    



  6. #16
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    later

    For later use

    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg
    https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS
    https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg
    https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t
    https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz
    https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5
    https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl
    https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh
    https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2
    https://www.youtube.com/watch?v=Sh1kZD7EVj0&lc=Ugz-pow-E8FDG8gFZ4l4AaABAg.9f8Bng22e5d9f8hoJGZY-5
    https://www.youtube.com/watch?v=Sh1kZD7EVj0&lc=Ugxev2gQt7BKZ0WYMfh4AaABAg.9f6hAjkC0ct9f8jleOui-u
    https://www.youtube.com/watch?v=Sh1kZD7EVj0&lc=Ugxg9iT7MPWGBWruIzR4AaABAg
    https://www.youtube.com/watch?v=tzbKqTRuRzU&lc=UgyYW2WZ2DvSrzUKnJ14AaABAg
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA



    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=UywjKEMjSp0&lc=UgxIySxHPqM1RxtVqoR4AaABAg.9edGvmwOLq99eekDyfS0 CD
    https://www.youtube.com/watch?v=UywjKEMjSp0&lc=UgxIySxHPqM1RxtVqoR4AaABAg.9edGvmwOLq99eevG7txd 2c
    https://www.youtube.com/watch?v=SIDLFRkUEIo&lc=UgzTF5vvB67Zbfs9qvx4AaABAg
    https://www.youtube.com/watch?v=9P6r7DLS77Q&lc=UgzytUUVRyw9U55-6M54AaABAg
    https://www.youtube.com/watch?v=9P6r7DLS77Q&lc=UgzCoa6tOVIBxRDDDbN4AaABAg
    https://www.youtube.com/watch?v=9P6r7DLS77Q&lc=UgyriWOelbVnw4FHWT54AaABAg.9dPo-OdLmZ09dc21kigjmr
    https://www.youtube.com/watch?v=363wd2EtQZ0&lc=UgzDQfo5rJqyVwvv2r54AaABAg
    https://www.youtube.com/watch?v=363wd2EtQZ0&lc=UgzHTSka7YppBdmUooV4AaABAg.9cXui6zzkz09cZttH_-2Gf
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgxhXnQ-mWYhrHWuM354AaABAg.9bepnegjnRu9iMmBDtf4m1
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgxFIZ858qf7w_uA9bd4AaABAg.9dKpEpUk3YT9dVEGnka6 yj
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=Ugz8oC8iGd6-SPhpaQZ4AaABAg.9bhRt-kPXri9brzh_99JF9
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=Ugz8oC8iGd6-SPhpaQZ4AaABAg.9bhRt-kPXri9bsrQIgXb3L
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgzFkoI0n_BxwnwVMcZ4AaABAg
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgxwJDkFskrMW8EpcXt4AaABAg.9bmKMz5-Z1g9bmx0REIz41
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgxhXnQ-mWYhrHWuM354AaABAg.9bepnegjnRu9bmyko2YUvQ
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgxwJDkFskrMW8EpcXt4AaABAg.9bmKMz5-Z1g9bmzpPqfLRD
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgzZwbV_Y_7UFzHwNBh4AaABAg.9dKb0Vc7MOB9dVK8si3o nt
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=Ugx6Ec_r4kb9EYOVgIt4AaABAg.9dOW613fb8V9dVIJECZI dC
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgwBho9tBLQ4nPVdYqd4AaABAg.9fWvoBWY3Da9g9cLjhPi az
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgzZy1NAMBx5Uv4U2cJ4AaABAg.9f0XX-_JaGp9g9bYLMZiIy
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgyL-xp8IiiahmQ12kJ4AaABAg.9f7xHCpAEx29g9asFhVFfT
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgxRxyFNNp3WHTzuiJJ4AaABAg.9fFR6ECmXk69g9afNBcS 4Z
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgwsdMh0FGDfvA249_B4AaABAg.9fLR6FHCIVI9g9aLlUyz og
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgwBho9tBLQ4nPVdYqd4AaABAg.9fWvoBWY3Da9g9_4422N zK
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=Ugwyy8JXr56HJ8m_od94AaABAg.9gSFgqqJQNV9gTXco41b 5l
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgyS8stMz5B9NrpPrbR4AaABAg.9gOjiS0rs8l9gTYl6Rld pA
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgyS8stMz5B9NrpPrbR4AaABAg.9gOjiS0rs8l9gTfhAWU9 ju
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgyS8stMz5B9NrpPrbR4AaABAg.9gOjiS0rs8l9gTfuYQGm Ua
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgyS8stMz5B9NrpPrbR4AaABAg.9gOjiS0rs8l9gTg3AmMP Uc
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgyS8stMz5B9NrpPrbR4AaABAg.9gOjiS0rs8l9gTgEqh5w do
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgxmUK0S_aZVZWz8-gt4AaABAg.9gLc3DfWfHl9gTZ3y6fL1H
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgzZloYeY2wQr7-xTOh4AaABAg.9gB2bbbs9mB9gTZUkNYI8e
    https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgzlM96nGEhW9J1Gpgd4AaABAg.9fmOFVcXZh49gT_8CYeQ gz
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 06-07-2024 at 12:53 PM.
    A Folk, A Forum, A Fuhrer ….

  7. #17
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    Coding for this post:
    https://www.excelfox.com/forum/showt...age2#post23768

    Note: The global variable declarations, Dim Clm As Long, Reocopy As Long , must be included at the top of the code module, so that they workm independently of the macros using them. Otherwise if they were declared inside any macro they would be local to that macro and could not be accessed by different macros as we need them to be. Just to explain that again a bit differently. If for example the declaration was done inside the recursion / reoccurring macro, then there would be an independent one for each copy of the recursion / reoccurring macro. That would only be referenced to by the code lines like Reocopy = Reocopy + 1 , Reocopy = Reocopy – 1 , and Clm = Clm + 1 specific to that copy, and further more they would "vanish" at the end of any copy macro. So those sort of declared variables could not be used to keep a running total or continual copy number reference which we want.

    Code:
    Option Explicit
    Dim Clm As Long, Reocopy As Long ' variable for column number to put file or folder details in, number representin the copy of the second macro
    
    
    Sub PassFolderForReocursing2()
    'Sub SchellFolderDetails2() '  Jan 2024  https://www.excelfox.com/forum/showthread.php/2936-YouTube-Video-making-and-editing-etc-coupled-to-excelfox-(-windows-Movie-Maker-)/page2#post23775
    Rem 0
     Let Clm = 0: Reocopy = -1
    Rem 1
    Dim Ws As Worksheet: Set Ws = Me   '   G:\YouTubeVideos&Anaslysis&HackingTricks\VideoRecordingEditing\Windows (Live) Movie Maker\Movie Maker Versions.xls
    ' 1b
    Dim Parf As String
    ' Let Parf = ThisWorkbook.Path & "\Versions  Downloads Exes\Verson 2, 2 1 2 5 Downloads 2,1\50 Euro Keks"
    ' Let Parf = ThisWorkbook.Path & "\50 Euro Keks"
     Let Parf = ThisWorkbook.Path
    ' 1c
        If Len(Parf) - Len(Replace(Parf, "\", "", 1, -1, vbBinaryCompare)) >= 2 Then
         Let ActiveCell = Mid(Parf, InStrRev(Parf, "\", InStrRev(Parf, "\", -1, vbBinaryCompare) - 1, vbBinaryCompare))
        Else
         Let ActiveCell = Parf
        End If
    Rem 2  Windows Shell object
    Dim objShell As Shell32.Shell: Set objShell = New Shell32.Shell            '    https://i.postimg.cc/Fz9zrnNm/Tools-Referrences-Microsoft-Shell-Controls-And-Automation.jpg     https://i.postimg.cc/sDC9S54h/Tools-Referrences-Microsoft-Shell-Controls-And-Automation.jpg
    Dim objFolder As Shell32.Folder: Set objFolder = objShell.Namespace(Parf)  '
    Rem 3 Movie Maker Folder Property names and Property values.
    Dim Fil As Shell32.FolderItem
        For Each Fil In objFolder.Items  '  We loop through all items to find the Movie Maker folder ' =======
            If Fil.Name = "Movie Maker" Then
            Dim Rw As Long: Let Rw = 1
             'Let ActiveCell.Offset(Rw, 0) = "Name": Let ActiveCell.Offset(Rw, 1) = objFolder.GetDetailsOf(Fil, 0)
             Let ActiveCell.Offset(Rw, 0) = objFolder.GetDetailsOf("Goolies", 0): Let ActiveCell.Offset(Rw, 1) = objFolder.GetDetailsOf(Fil, 0)
             'Let ActiveCell.Offset(Rw + 1, 0) = "Größe": Let ActiveCell.Offset(Rw + 1, 1) = objFolder.GetDetailsOf(Fil, 1)
             Let ActiveCell.Offset(Rw + 1, 0) = objFolder.GetDetailsOf(71, 1): Let ActiveCell.Offset(Rw + 1, 1) = objFolder.GetDetailsOf(Fil, 1)
             'Let ActiveCell.Offset(Rw + 2, 0) = "Elementtyp": Let ActiveCell.Offset(Rw + 2, 1) = objFolder.GetDetailsOf(Fil, 2)
             Let ActiveCell.Offset(Rw + 2, 0) = objFolder.GetDetailsOf(Parf, 2): Let ActiveCell.Offset(Rw + 2, 1) = objFolder.GetDetailsOf(Fil, 2)
             'Let ActiveCell.Offset(Rw + 3, 0) = "Änderungsdatum": Let ActiveCell.Offset(Rw + 3, 1) = Left(objFolder.GetDetailsOf(Fil, 3), InStr(1, objFolder.GetDetailsOf(Fil, 3), " ", vbBinaryCompare))
             Let ActiveCell.Offset(Rw + 3, 0) = objFolder.GetDetailsOf(Ws, 3): Let ActiveCell.Offset(Rw + 3, 1) = Left(objFolder.GetDetailsOf(Fil, 3), InStr(1, objFolder.GetDetailsOf(Fil, 3), " ", vbBinaryCompare))
             'Let ActiveCell.Offset(Rw + 4, 0) = "Erstelldatum": Let ActiveCell.Offset(Rw + 4, 1) = Left(objFolder.GetDetailsOf(Fil, 4), InStr(1, objFolder.GetDetailsOf(Fil, 4), " ", vbBinaryCompare))
             Let ActiveCell.Offset(Rw + 4, 0) = objFolder.GetDetailsOf(Left("gh", 2), 4): Let ActiveCell.Offset(Rw + 4, 1) = Left(objFolder.GetDetailsOf(Fil, 4), InStr(1, objFolder.GetDetailsOf(Fil, 4), " ", vbBinaryCompare))
        '     Let ActiveCell.Offset(Rw + 9, 0) = "Dateiversion": Let ActiveCell.Offset(Rw + 9, 1) = objFolder.GetDetailsOf(Fil, 166)
             Let ActiveCell.Offset(Rw + 5, 0) = objFolder.GetDetailsOf("Bum", 166): Let ActiveCell.Offset(Rw + 5, 1) = objFolder.GetDetailsOf(Fil, 166)
            
             Rem 4
             ActiveCell.Offset(0, 2).Activate
             ' 4b
             Call ReoccurringFileFolderProps2(Parf & "\Movie Maker")
             Exit For ' Once we have passed on the full path of the folder,  Movie Maker  , then we are finished with this macro, so we don't need loop further looking fot the Movie Maker folder
            Else
            End If
        Next Fil ' ===========================================================================================
    End Sub
    
    '    https://www.excelfox.com/forum/showthread.php/2936-YouTube-Video-making-and-editing-etc-coupled-to-excelfox-(-windows-Movie-Maker-)/page2#post23774
    Private Sub ReoccurringFileFolderProps2(ByVal Pf As String)
    Rem 0
     Let Reocopy = Reocopy + 1 ' Originally the variable  Reocopy  is zero.  It will become 1 on first entering the macro.  Every time we leave this macro, this number is reduced by 1   So in simple use it will be 1 or zero indicating that a copy is in use.  However, should this macro "Call itself", before its finished , ( the recursion idea ) then the value will be 2  and so on.  So effectively it tells us which copy is running at any time
    Rem 1
    Dim objShell As Shell32.Shell: Set objShell = New Shell32.Shell            '    https://i.postimg.cc/Fz9zrnNm/Tools-Referrences-Microsoft-Shell-Controls-And-Automation.jpg     https://i.postimg.cc/sDC9S54h/Tools-Referrences-Microsoft-Shell-Controls-And-Automation.jpg
    Dim objFolder As Shell32.Folder: Set objFolder = objShell.Namespace(Pf)  '
    Rem 2
    Dim Fil As Shell32.FolderItem
        For Each Fil In objFolder.Items ' ======= Main Loop ==================================================|
        ' Dim Clm As Long: ' Global variable
         Let Clm = Clm + 1
        Dim Rw As Long: Let Rw = 1 + Reocopy + 1
             Let ActiveCell.Offset(Rw, Clm) = objFolder.GetDetailsOf(Fil, 0)
             Let ActiveCell.Offset(Rw + 1, Clm) = objFolder.GetDetailsOf(Fil, 1)
             Let ActiveCell.Offset(Rw + 2, Clm) = objFolder.GetDetailsOf(Fil, 2)
             Let ActiveCell.Offset(Rw + 3, Clm) = Left(objFolder.GetDetailsOf(Fil, 3), InStr(1, objFolder.GetDetailsOf(Fil, 3), " ", vbBinaryCompare))
             Let ActiveCell.Offset(Rw + 4, Clm) = Left(objFolder.GetDetailsOf(Fil, 4), InStr(1, objFolder.GetDetailsOf(Fil, 4), " ", vbBinaryCompare))
        '                                     Let ActiveCell.Offset(Rw + 9, 0) = "Dateiversion": Let ActiveCell.Offset(Rw + 9, 1) = objFolder.GetDetailsOf(Fil, 166)
             Let ActiveCell.Offset(Rw + 5, Clm) = objFolder.GetDetailsOf(Fil, 166)
            '_________________________________________________________________________________________________
            ' 2b  Here we may pause the macro, whilst another copy of it is started
            If objFolder.GetDetailsOf(Fil, 2) = "Dateiordner" Then Call ReoccurringFileFolderProps2(Pf & "\" & objFolder.GetDetailsOf(Fil, 0))
            '_________________________________________________________________________________________________
        '   If we did pause whilst the abobe code line set off another copy, then when that is finished we will come here and resume the paused previous copy
        Next Fil ' ============================== Main Loop  =================================================|
     
     
     Let Reocopy = Reocopy - 1  ' We are finished at this point with this running copy of the macro. (The next code line ends it). This code line here will reduce the value used to keep track of the  copy number being run
    End Sub

  8. #18
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    This is post
    https://www.excelfox.com/forum/showt...ll=1#post23924
    https://www.excelfox.com/forum/showt...ge18#post23924






    Some notes in support of these Thread Posts

    https://www.eileenslounge.com/viewto...313622#p313622
    https://www.excelfox.com/forum/showt...age2#post23769


    Here’s the thing.
    The Windows Shell object, (WSO), folder item way is a nice way to get at an extensive list of folder and file properties for the files and folders , (items), in a Folder.( https://www.youtube.com/watch?v=jTmVtPHtiTg ). But it’s a bit broken in places and/ or is not so precise in some size properties. But for now I want to do the main looping with the WSO.
    The main purpose of this small test macro snippet is part of investigating a combination of the Windows Shell object folder item way and the Microsoft Scripting Runtime, (FSO), way to get some properties of the files ( and sub folders and their contents ) in a programmes folder of a software. This is for the purpose of comparing different versions of the same software, ( or to help determine if something masquerading as a software is a fake or has some unexpected additions or alterations ).



    Code:
    ' To test, run this macro in any workbook that is in any folder, but that folder must also include this sample Folder,  MMPropertyTest    https://app.box.com/s/27u7dyjee3rez44pdjq52uu2e7tgzu8v
    Sub TestWindowsShellObjectFolderItemWithFSOway()  '  https://www.excelfox.com/forum/showthread.php/2056-Appendix-Thread-2-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=23924&viewfull=1#post23924     https://www.eileenslounge.com/viewtopic.php?p=313622#p313622    https://www.excelfox.com/forum/showthread.php/2936-YouTube-Video-making-and-editing-etc-coupled-to-excelfox-(-windows-Movie-Maker-)/page2#post23769
    ' Early Binding Microsoft Scripting Runtime
    'Dim objFSO As Scripting.FileSystemObject: Set objFSO = New Scripting.FileSystemObject     ' https://i.postimg.cc/d1GHPGxJ/Microsoft-Scripting-Runtime-Library.jpg
    ' Late Binding
    Dim objFSO As Object: Set objFSO = CreateObject("Scripting.FileSystemObject")
    
    ' Early Binding for windows shell object   Microsoft Shell Controls And Automation
    'Dim objWSO As Shell32.Shell: Set objWSO = New Shell32.Shell                            '    https://i.postimg.cc/Fz9zrnNm/Tools-Referrences-Microsoft-Shell-Controls-And-Automation.jpg     https://i.postimg.cc/sDC9S54h/Tools-Referrences-Microsoft-Shell-Controls-And-Automation.jpg
    ' Late Binding
    Dim objWSO As Object: Set objWSO = CreateObject("shell.application")
    
    'Dim objWSOFolder As Shell32.Folder
    Dim objWSOFolder As Object
     
    ' ------- This section may not be needed by most people. I dabble in both English and German systems so I can't easilly hard code the item type name given for a folder by the WSO  ( In German operating systems it is   Dateiordner    )
     Set objWSOFolder = objWSO.Namespace(ThisWorkbook.Path)
    'Dim FldItm As Shell32.FolderItem
    Dim FldItm As Object
        For Each FldItm In objWSOFolder.Items
        Dim NmeOfAFldr As String
            If objWSOFolder.GetDetailsOf(FldItm, 0) = "MMPropertyTest" Then
             Let NmeOfAFldr = objWSOFolder.GetDetailsOf(FldItm, 2): Debug.Print NmeOfAFldr '  In German OS this is  Dateiordner
             Exit For ' I got what I want so don't meed to loop anymore
            Else
            End If
        Next FldItm
    ' -------
    
    ' Now move on to getting some property detains of all items in the WSO folder object,  objWSOFolder
     Set objWSOFolder = objWSO.Namespace(ThisWorkbook.Path & "\MMPropertyTest")
    'Dim FldItm As Shell32.FolderItem
        For Each FldItm In objWSOFolder.Items
        Dim Clm As Long: Let Clm = Clm + 1 ' For convenience each items properties will be put in the next column
        Dim Rw As Long: Let Rw = 1         ' The row of the property
        ' Property   Name of file or folder
        Let ActiveCell.Offset(Rw, Clm) = objWSOFolder.GetDetailsOf(FldItm, 0)       '   Name of folder or file  using the WSO way
        ' Property   File or folder size. I use the FSO for this to get a better precision and also because it seems to be broken for a folder item in WSO
            If objWSOFolder.GetDetailsOf(FldItm, 2) = NmeOfAFldr Then               '   GetDetailsOf(FldItm, 2)   tells me the type of the WSO item
            'Dim objFSOFolder As Scripting.Folder: Set objFSOFolder = objFSO.GetFolder(ThisWorkbook.Path & "\MMPropertyTest\" & objWSOFolder.GetDetailsOf(FldItm, 0))
            Dim objFSOFolder As Object: Set objFSOFolder = objFSO.GetFolder(ThisWorkbook.Path & "\MMPropertyTest\" & objWSOFolder.GetDetailsOf(FldItm, 0))
             Let ActiveCell.Offset(Rw + 1, Clm) = objFSOFolder.Size
            Else ' If the item is not a folder, then I assume it will be a file?
            'Dim ObjFSOFile As Scripting.File: Set ObjFSOFile = objFSO.GetFile(ThisWorkbook.Path & "\MMPropertyTest\" & objWSOFolder.GetDetailsOf(FldItm, 0))
            Dim ObjFSOFile As Object: Set ObjFSOFile = objFSO.GetFile(ThisWorkbook.Path & "\MMPropertyTest\" & objWSOFolder.GetDetailsOf(FldItm, 0))
             Let ActiveCell.Offset(Rw + 1, Clm) = ObjFSOFile.Size
            End If
        ' Property   Date Last Modified   Änderungsdatum
         Let ActiveCell.Offset(Rw + 2, Clm) = Format(objWSOFolder.GetDetailsOf(FldItm, 3), "dd,mmm,yy")
        ' Property   Date Created         Erstelldatum
         Let ActiveCell.Offset(Rw + 3, Clm) = Format(objWSOFolder.GetDetailsOf(FldItm, 4), "dd,mmm,yy")
        ' Property   Version
         Let ActiveCell.Offset(Rw + 4, Clm) = objWSOFolder.GetDetailsOf(FldItm, 166)
        Next FldItm
    End Sub



    To test this coding, put this test folder,
    MMPropertyTest https://app.box.com/s/27u7dyjee3rez44pdjq52uu2e7tgzu8v
    , in any folder. Run the macro from any Excel file that is in the same folder that you put the folder MMPropertyTest in.
    The results should be of this sort of form:
    https://i.postimg.cc/k4FLjVpG/WSOwith-FSO-Test.jpg







    MMPropertyTest https://app.box.com/s/27u7dyjee3rez44pdjq52uu2e7tgzu8v

  9. #19
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    I took another little time out, as I was trying to tidy up my recursion / reoccurring coding, and I got a bit annoyed by Me.ActiveSheet not working.
    https://eileenslounge.com/viewtopic.php?f=30&t=40560
    I have that one sussed now I think,
    https://www.excelfox.com/forum/showt...ll=1#post23926
    See also the next few posts, ( as referenced from https://eileenslounge.com/viewtopic.php?f=30&t=40560 )

    So onward with the recursion/reoccurring coding, with a few modifications, mainly for the improved size property figures, but also a bit of general tidying up

    Here is the next version of the recursion/ reoccurring coding

    Code:
    Option Explicit
    '  "Global" variables that must be declared here
    Dim Clm As Long, Reocopy As Long ' variable for column number to put file or folder details in, number representing the copy of the second macro running at any time
    '  Variables useful/ efficient to declare here as "Global" variables
    Dim objWSO As Shell32.Shell                 ' Early Binding          ' Set objShell = New Shell32.Shell             '    https://i.postimg.cc/Fz9zrnNm/Tools-Referrences-Microsoft-Shell-Controls-And-Automation.jpg     https://i.postimg.cc/sDC9S54h/Tools-Referrences-Microsoft-Shell-Controls-And-Automation.jpg
    Dim objFSO As Scripting.FileSystemObject    ' Early Binding          ' Set objFSO = New Scripting.FileSystemObject  ' https://i.postimg.cc/d1GHPGxJ/Microsoft-Scripting-Runtime-Library.jpg
    Dim MeActiveCell As Range                   ' For convenience all output will be referred to a start point. The user should make a selection in the workbook window that has the worksheet for output showing in it.  We will then be able to get the ramge object into VBA from the  ActiveCell  property of that workbook window
    Sub PassFolderForReocursing3()  '
    Rem 0
     Let Clm = 1: Reocopy = 0                                         ' When this macro starts we have not started any output so our column number for output should not yet have been set, and no copies of the next macro will be running so the variable keeping track of the copy number of that macro should not have a number >= 1
    Rem 1
    Dim Ws As Worksheet: Set Ws = Me                                  ' This is and the next bits are a personal preferrence. I like to fully explicitly tell VBA where things are, and I also have a habit of putting coding intended for a worksheet in that particular worksheets code module. Many people work on whatever worksheet is active, so they may prefer to change this to   Set Ws = Application.ActiveSheet, and use that in the next bit.
    Me.Activate: Set MeActiveCell = Workbooks(Me.Parent.Name).Windows.Item(1).ActiveCell ' https://eileenslounge.com/viewtopic.php?p=313747#p313747
    ' 1b
    Dim Parf As String:  Let Parf = ThisWorkbook.Path                 ' This should be given the path to the folder where the folder of interest is, so theere is a good chance this will need to be changed to suit quit often.
    ' 1c  A short string part of the path put top left, not necerssary but just useful for later referrence to give indication of where the main folder was got from
        If Len(Parf) - Len(Replace(Parf, "\", "", 1, -1, vbBinaryCompare)) >= 2 Then ' For a longer path it may be convenient to shorten the output given to the last bit
         Let MeActiveCell = Mid(Parf, InStrRev(Parf, "\", InStrRev(Parf, "\", -1, vbBinaryCompare) - 1, vbBinaryCompare))
        Else ' For a shorter path we can give the full path
         Let MeActiveCell = Parf
        End If
    Rem 2  Windows Shell object
     Set objWSO = New Shell32.Shell                            '    https://i.postimg.cc/Fz9zrnNm/Tools-Referrences-Microsoft-Shell-Controls-And-Automation.jpg     https://i.postimg.cc/sDC9S54h/Tools-Referrences-Microsoft-Shell-Controls-And-Automation.jpg
    Dim objWSOFolder As Shell32.Folder: Set objWSOFolder = objWSO.Namespace(Parf)
    
    Rem 3 Movie Maker Folder Property names and Property values.
    Dim FldItm As Shell32.FolderItem
        For Each FldItm In objWSOFolder.Items  '  We loop through all items to find the Movie Maker folder ' =======
            If FldItm.Name = "Movie Maker" Then
            Dim Rw As Long: Let Rw = 1
            ' Property   Name of file or folder
             Let MeActiveCell.Offset(Rw, 0) = objWSOFolder.GetDetailsOf("Willy", 0)
             Let MeActiveCell.Offset(Rw, Clm) = objWSOFolder.GetDetailsOf(FldItm, 0)       '   Name of folder or file  using the WSO way
            ' Property   File or folder size. I use the FSO for this to get a better precision and also because it seems to be broken for a folder item in WSO
             Let MeActiveCell.Offset(Rw + 1, 0) = objWSOFolder.GetDetailsOf("Wonka", 1)
                If objWSOFolder.GetDetailsOf(FldItm, 2) = "Dateiordner" Then                '   GetDetailsOf(FldItm, 2)   tells me the type of the WSO item
                Set objFSO = New Scripting.FileSystemObject     ' https://i.postimg.cc/d1GHPGxJ/Microsoft-Scripting-Runtime-Library.jpg
                'Dim objFSOFolder As Scripting.Folder: Set objFSOFolder = objFSO.GetFolder(ThisWorkbook.Path & "\MMPropertyTest\" & objWSOFolder.GetDetailsOf(FldItm, 0))
                Dim objFSOFolder As Scripting.Folder: Set objFSOFolder = objFSO.GetFolder(ThisWorkbook.Path & "\" & objWSOFolder.GetDetailsOf(FldItm, 0))
                 Let MeActiveCell.Offset(Rw + 1, Clm) = objFSOFolder.Size
                Else ' If the item is not a folder, then I assume it will be a file?
                Dim ObjFSOFile As Scripting.File: Set ObjFSOFile = objFSO.GetFile(ThisWorkbook.Path & "\" & objWSOFolder.GetDetailsOf(FldItm, 0))
                 Let MeActiveCell.Offset(Rw + 1, Clm) = ObjFSOFile.Size
                End If
             ' Property   Date Last Modified   Änderungsdatum
              Let MeActiveCell.Offset(Rw + 2, 0) = objWSOFolder.GetDetailsOf(42, 3)
              Let MeActiveCell.Offset(Rw + 2, Clm) = Format(objWSOFolder.GetDetailsOf(FldItm, 3), "dd,mmm,yy")
             ' Property   Date Created         Erstelldatum
              Let MeActiveCell.Offset(Rw + 3, 0) = objWSOFolder.GetDetailsOf(42, 4)
              Let MeActiveCell.Offset(Rw + 3, Clm) = Format(objWSOFolder.GetDetailsOf(FldItm, 4), "dd,mmm,yy")
             ' Property   Version
              Let MeActiveCell.Offset(Rw + 4, Clm) = objWSOFolder.GetDetailsOf(666, 166)
              Let MeActiveCell.Offset(Rw + 4, Clm) = objWSOFolder.GetDetailsOf(FldItm, 166)
             Rem 4
             Let Clm = 0
             MeActiveCell.Offset(0, 2).Select: Set MeActiveCell = Workbooks(Me.Parent.Name).Windows.Item(1).ActiveCell ' https://eileenslounge.com/viewtopic.php?p=313747#p313747
             ' 4b
             Call ReoccurringFldItmeFolderProps3(Parf & "\Movie Maker")
             Exit For ' Once we have passed on the full path of the folder,  Movie Maker  , then we are finished with this macro, so we don't need loop further looking fot the Movie Maker folder
            Else
            End If
        Next FldItm ' ===========================================================================================
    End Sub
    
    Private Sub ReoccurringFldItmeFolderProps3(ByVal Pf As String)
    Rem 0
     Let Reocopy = Reocopy + 1 ' Originally the variable  Reocopy  is zero.  It will become 1 on first entering the macro.  Every time we leave this macro, this number is reduced by 1   So in simple use it will be 1 or zero indicating that a copy is in use.  However, should this macro "Call itself", before its finished , ( the recursion idea ) then the value will be 2  and so on.  So effectively it tells us which copy is running at any time
    Rem 1
     Set objWSO = New Shell32.Shell            '    https://i.postimg.cc/Fz9zrnNm/Tools-Referrences-Microsoft-Shell-Controls-And-Automation.jpg     https://i.postimg.cc/sDC9S54h/Tools-Referrences-Microsoft-Shell-Controls-And-Automation.jpg
    Dim objWSOFolder As Shell32.Folder: Set objWSOFolder = objWSO.Namespace(Pf)  '
    Rem 2
    Dim FldItm As Shell32.FolderItem
        For Each FldItm In objWSOFolder.Items ' ======= Main Loop ==================================================|
        ' Dim Clm As Long: ' Global variable
         Let Clm = Clm + 1
        Dim Rw As Long: Let Rw = Reocopy + 1
             Let MeActiveCell.Offset(Rw, Clm) = objWSOFolder.GetDetailsOf(FldItm, 0)
                If objWSOFolder.GetDetailsOf(FldItm, 2) = "Dateiordner" Then                '   GetDetailsOf(FldItm, 2)   tells me the type of the WSO item
                Set objFSO = New Scripting.FileSystemObject     ' https://i.postimg.cc/d1GHPGxJ/Microsoft-Scripting-Runtime-Library.jpg
                'Dim objFSOFolder As Scripting.Folder: Set objFSOFolder = objFSO.GetFolder(ThisWorkbook.Path & "\MMPropertyTest\" & objWSOFolder.GetDetailsOf(FldItm, 0))
                Dim objFSOFolder As Scripting.Folder: Set objFSOFolder = objFSO.GetFolder(Pf & "\" & objWSOFolder.GetDetailsOf(FldItm, 0))
                 Let MeActiveCell.Offset(Rw + 1, Clm) = objFSOFolder.Size
                Else ' If the item is not a folder, then I assume it will be a file?
                Dim ObjFSOFile As Scripting.File: Set ObjFSOFile = objFSO.GetFile(Pf & "\" & objWSOFolder.GetDetailsOf(FldItm, 0))
                 Let MeActiveCell.Offset(Rw + 1, Clm) = ObjFSOFile.Size
                End If
             Let MeActiveCell.Offset(Rw + 2, Clm) = Format(objWSOFolder.GetDetailsOf(FldItm, 3), "dd,mmm,yy")
             Let MeActiveCell.Offset(Rw + 3, Clm) = Format(objWSOFolder.GetDetailsOf(FldItm, 4), "dd,mmm,yy")
             Let MeActiveCell.Offset(Rw + 4, Clm) = objWSOFolder.GetDetailsOf(FldItm, 166)
            '_________________________________________________________________________________________________
            ' 2b  Here we may pause the macro, whilst another copy of it is started
            If objWSOFolder.GetDetailsOf(FldItm, 2) = "Dateiordner" Then Call ReoccurringFldItmeFolderProps3(Pf & "\" & objWSOFolder.GetDetailsOf(FldItm, 0))
            '_________________________________________________________________________________________________
        '   If we did pause whilst the abobe code line set off another copy, then when that is finished we will come here and resume the paused previous copy
        Next FldItm ' ============================== Main Loop  =================================================|
     
     
     Let Reocopy = Reocopy - 1  ' We are finished at this point with this running copy of the macro. (The next code line ends it). This code line here will reduce the value used to keep track of the  copy number being run
    End Sub
    

    Working on this Movie Maker folder,
    Movie Maker https://app.box.com/s/cxvc735a85q6az2r3gtb7ii9w2p3jzpf
    , gives this https://i.postimg.cc/Gt7rMkSM/Recurs...g-coding-3.jpg



    And here all the codings so far
    https://i.postimg.cc/sxDs9nKQ/Initia...ng-outputs.jpg


    To demo: See next post

  10. #20
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10



    To Demo: Put Folder, Movie Maker , and file Movie Maker Versions.xls in the same place

    Test Folder
    Movie Maker https://app.box.com/s/cxvc735a85q6az2r3gtb7ii9w2p3jzpf

    Run the macro Sub PassFolderForReocursing3() from withing the worksheets Version 2 code module in this file
    Movie Maker Versions.xls https://app.box.com/s/axle7nflnmgkfbztto1wsmhc2ml2ynes



    As per the demo, Working on this Movie Maker folder,
    Movie Maker https://app.box.com/s/cxvc735a85q6az2r3gtb7ii9w2p3jzpf
    , should give this https://i.postimg.cc/Gt7rMkSM/Recurs...g-coding-3.jpg



    And here all the codings so far
    https://i.postimg.cc/sxDs9nKQ/Initia...ng-outputs.jpg



    The whole point of all this is to do this sort of manually looking at stuff better and quicker.
    https://i.postimg.cc/7YJxCzCw/Explor...nd-Folders.jpg

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •