Re: Help Me Fix Script



"Dennis Marks" <denmarks@xxxxxxxxx> wrote in message
news:1131328491_6557@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
: Months ago I used the following vbs script to extract all the ID3 tags
from
: a directory and put them in a tab delimited file. The file could then be
: opened in a spreadsheet. I lost the script but was able to locate a
version
: on the internet that may not be complete. I don't even remember how to use
: it. Can someone look at the script, tell me if it is complete and how do I
: use it? I find reference to the output file but I'm not sure how to
: associate it with the directory. BTW: as you can see I am not a VBS
: programmer.
:
: Set objShell = CreateObject("Shell.Application")
: Set Ag=Wscript.Arguments
: Set Fldr=objShell.NameSpace(Ag(0))
: Set FldrItems=Fldr.Items
: Set fso = CreateObject("Scripting.FileSystemObject")
: FName="c:\documents and settings\Dennis Marks\my documents\Directory
: List.txt"
: Set ts = fso.OpenTextFile(FName, 2, vbtrue)
: For x = 0 to 50
: t1 = t1 & Fldr.GetDetailsOf(vbnull, x) & vbtab
: Next
: ts.write FLDR.self.path & vbcrlf
: ts.Write T1 & vbcrlf
: T1=""
: For Each FldrItem in FldrItems
: For x = 0 to 50
: t1 = t1 & Fldr.GetDetailsOf(FldrItem, x) & vbtab
: Next
: t1=t1 & vbcrlf
: ts.Write T1
: T1=""
: Next
: msgbox FName & " has a tab delimited list of all properties"

A slightly modified version:

Option Explicit
dim oShell, oArgs, oFolder, fso, filename, f, i, arr, pathto, files, file
pathto = "c:\"
set oShell = CreateObject("Shell.Application")
set oArgs = Wscript.Arguments
if oArgs.count = 0 then
msgbox "Error: Argument not included"
wscript.echo "You must include the full path to a folder as an argument"
wscript.quit
end if
set oFolder = oShell.NameSpace(oArgs(0))
set fso = CreateObject("Scripting.FileSystemObject")
arr = split(oFolder,"\")
filename = pathto & arr(ubound(arr)) & ".txt"
set f = fso.OpenTextFile(filename, 2, true)
for i = 0 to 50
files = files & oFolder.GetDetailsOf(vbNull, i) & vbTab
Next
f.write oFolder.self.path & vbCrLf
f.Write files & vbcrlf
files = ""
for each file in oFolder.items
for i = 0 to 50
files = files & oFolder.GetDetailsOf(file, i) & vbTab
Next
files = files & vbcrlf
f.Write files
files = ""
Next
f.close
msgbox "A list of files in " & oArgs(0) & " have been written to " &
filename
set f = nothing
set fso = nothing
set oFolder = nothing
set oArgs = nothing
set oShell = nothing

I called it props.vbs. Call it with: cscript props.vbs [full path to
folder]

Ex. cscript props.vbs c:\myfiles

If the path to the folder has a space, you must include it in double-quotes.

Ex. cscript props.vbs "c:\my files"

You can change the pathto variable to the folder you want to write the
output file to. The output file will have the folder name that was
processed.

HTH...

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp


.



Relevant Pages

  • Re: Script not working in Vista
    ... If the folder contains other folders it works fine, but if the folder contains files I get an error stating "Line 31, Char 2, Invalid procedure call or argument, Code 800A0005" ... This script worked OK with XP but I'm having this problem on Vista Ultimate ... Set ts = fso.OpenTextFile(FName, 2, vbtrue) ... ts.write FLDR.self.path &vbcrlf ...
    (microsoft.public.scripting.vbscript)
  • Re: Script not working in Vista
    ... If the folder contains other folders it works fine, but if the folder contains files I get an error stating "Line 31, Char 2, Invalid procedure call or argument, Code 800A0005" ... This script worked OK with XP but I'm having this problem on Vista Ultimate ... Set ts = fso.OpenTextFile(FName, 2, vbtrue) ... ts.write FLDR.self.path &vbcrlf ...
    (microsoft.public.scripting.vbscript)
  • Help Me Fix Script
    ... Months ago I used the following vbs script to extract all the ID3 tags from ... ts.write FLDR.self.path & vbcrlf ... For Each FldrItem in FldrItems ...
    (microsoft.public.scripting.vbscript)
  • Script not working in Vista
    ... I have a script to list the contents of a folder when dragged and dropped on to it. ... ts.write FLDR.self.path &vbcrlf ... For Each FldrItem in FldrItems ...
    (microsoft.public.scripting.vbscript)
  • Re: .VBS script help (simple?)
    ... I have a simple VBS script that lets me know when data has been added to a folder. ... What i want to do is have it check several folders The script below checks one folder fine but i can not figure out how to have it check multiple folders. ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.windows.server.scripting)