Hi Guys-
Really new to vb scripting.
Trying to run a command prompt within vb script.
Dim fso,f,ext,firstChar,numOfPics,workingFolder,newFileName
workingFolder = "."
numOfPics = 0
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(workingFolder)
For Each file In f.Files
firstChar = mid(file.Name,1,1)
ext = mid(file.Name,(len(file.Name) - 2),3)
if firstChar = "P" and ext = "JPG" then
numOfPics = numOfPics + 1
newFileName = mid(file.Name,2,len(file.Name) - 1)
fso.MoveFile workingFolder & "\" & file.Name, workingFolder & "\" & newFileName
end if
Next
wscript.echo "Total renamed pics: " & numOfPics
Set fso = Nothing
DIM objShell
set objShell = wscript.createObject("wscript.shell")
iReturn = objShell.Run("%COMSPEC%/K Dir z:\Photgraph\convert -resize 120x150 *.jpg *)
The first part of the script works fine, renames image files. I'm trying to set up the second part to run a command prompt which resizes those images.
DIM objShell
set objShell = wscript.createObject("wscript.shell")
iReturn = objShell.Run("%COMSPEC%/K Dir z:\Photgraph\convert -resize 120x150 *.jpg *)
Any help would be greatly appreciated.
Really new to vb scripting.
Trying to run a command prompt within vb script.
Dim fso,f,ext,firstChar,numOfPics,workingFolder,newFileName
workingFolder = "."
numOfPics = 0
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(workingFolder)
For Each file In f.Files
firstChar = mid(file.Name,1,1)
ext = mid(file.Name,(len(file.Name) - 2),3)
if firstChar = "P" and ext = "JPG" then
numOfPics = numOfPics + 1
newFileName = mid(file.Name,2,len(file.Name) - 1)
fso.MoveFile workingFolder & "\" & file.Name, workingFolder & "\" & newFileName
end if
Next
wscript.echo "Total renamed pics: " & numOfPics
Set fso = Nothing
DIM objShell
set objShell = wscript.createObject("wscript.shell")
iReturn = objShell.Run("%COMSPEC%/K Dir z:\Photgraph\convert -resize 120x150 *.jpg *)
The first part of the script works fine, renames image files. I'm trying to set up the second part to run a command prompt which resizes those images.
DIM objShell
set objShell = wscript.createObject("wscript.shell")
iReturn = objShell.Run("%COMSPEC%/K Dir z:\Photgraph\convert -resize 120x150 *.jpg *)
Any help would be greatly appreciated.