VBS - wshell.run based on file contents?
Afternoon Folks,
My second query of the day regarding VBS;
Is it at all possible to exec a command within VBS, based on lines within a text document.
At present I have a portion of script to index the current folder:
Code:
Set write = CreateObject("Scripting.FileSystemObject")
sFolder = "Y:\"
Set newfile = write.CreateTextFile(sFolder&"\Resources\pdf_list.txt", True)
Set folder = wrIte.GetFolder(sFolder)
Set files = folder.files
For each folderIdx In files
newfile.writeline(folderIdx.Name)
Next
newfile.Close
From there I would like to exec the following snippet for every line in the document:
Code:
Set cmd= wscript.createobject("WScript.shell")
cmd.run "cmd /K cd c:\Program Files\Program\ & command.exe Y:\file.pdf -CY:\Resources\macro.txt -i", 0
Is there any means to get the second snippet to run the said command on each line of the file. The above command is a third part PDF renaming solution designed to rename files based on content, I.e. Invoice number at a specified location, and a trimming mechanism to only attain the actual number, as previous these are named 00*****.pdf as the invoice number.
pdf_list.txt:
Code:
AB invoice (13112009 214705).PDF
AC invoice (3112009 214704).PDF
BU invoice (13112009 214706).PDF
DP invoice (13112009 214716).PDF
FI invoice (13112009 214718).PDF