Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.comp.os.windows-xp    |    Actually wasn't too bad for a M$-OS    |    17,273 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 16,930 of 17,273    |
|    Newyana2 to R.Wieser    |
|    Re: vbscript: how to generate a FolderIt    |
|    22 Jun 24 08:11:15    |
   
   XPost: alt.windows7.general   
   From: newyana@invalid.nospam   
      
   On 6/22/2024 6:14 AM, R.Wieser wrote:   
   > Set objDlg = WScript.CreateObject("Shell.Application")   
   >   
   > '-- returns a Folder3 object   
   > Set oNSFolder = objDlg.NameSpace(folderName)   
   >   
   > '-- returns FolderItem2 objects   
   > For Each oNSFile In oNSFolder.items   
   >   
   > '-- the "Artist" property value   
   > sProperty = oNSFolder.GetDetailsOf(oNSFile, 16)   
      
    I'm not aware of any direct access to these compound objects.   
   VBS is only referencing a Folder object. In VB with early binding   
   it's the same. There's no sorting through versions. The following seems   
   to do what you want. I set it to return date rather than artist. I'm   
   not sure if I have a file with the artist property filled in.   
      
    Note that Namespace is available on XP, but the Self property   
   of a folder object is not available until IE6. That can lead to some   
   fairly complicated code in some cases.   
      
   Dim ObjDlg, oNSFolder, oNSFile, sProperty   
   Set ObjDlg = WScript.CreateObject("Shell.Application")   
      
   '-- returns a Folder3 object   
   Set oNSFolder = ObjDlg.NameSpace("C:\windows\desktop\fol1")   
   MsgBox Typename(oNSFolder)   
      
   '-- returns FolderItem2 objects.. do we care? It works.   
   For Each oNSFile In oNSFolder.items   
    If oNSFile.Name = "river.png" Then   
    sProperty = oNSFolder.GetDetailsOf(oNSFile, 3) 'date   
    MsgBox Typename(oNSFile) & vbCrLf & oNSFile.Name & vbCrLf & sProperty   
    End If   
    Next   
   Set oNSFolder = Nothing   
   Set ObjDlg = Nothing   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca