well, I finished the code, works as intended
In the end, I generated a ".bat" and run it because if processed as an individual "objShell.Run" it opened for every pdf a separate cmd window, which was not acceptable.
thanks all for the hints. :)
dim sFolder,MyArray
dim FSO,OutPutFile
dim networkInfo
Dim objShell
dim commmand,commmand2
dim ffso, crit
Dim intAnswer
dim nn
sFolder = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName)
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set networkInfo = CreateObject("WScript.NetWork")
Set objShell = WScript.CreateObject("WScript.Shell")
Set ffso = CreateObject("Scripting.FileSystemObject")
tmpfile=ffso.getspecialfolder(2) & "\" & ffso.gettempname
tmpfile=tmpfile & ".bat"
set ffso=createobject("scripting.filesystemobject")
set ots=ffso.opentextfile(tmpfile,2,true)
ots.writeline "@echo off"
ots.writeline "setlocal"
intAnswer = _
Msgbox("Procesare doar cu Rutare?" & vbNewLine & "Yes - doar cele cu #"& vbNewLine & "No - toate fisierele", _
vbYesNo, "Selectie ")
If intAnswer = vbYes Then
crit = "#.pdf"
Else
crit = ".pdf"
End If
nn = 0
For Each oFile In oFSO.GetFolder(sFolder).Files
If Instr( 1, oFile.Name, crit, vbTextCompare )>0 Then
nn=nn+1
dirname = Replace(oFile.Name,"." & oFSO.GetExtensionName(oFile.Path),"")
on error resume next
oFSO.CreateFolder dirname
on error goto 0
if Instr( 1, oFile.Name, "#.pdf", vbTextCompare )>0 then
MyArray = Split(oFile.Name, "#", -1, 1)
rutare = MyArray(UBound(MyArray)-1)
else
rutare = Replace(oFile.Name,"." & oFSO.GetExtensionName(oFile.Path),"")
end if
Set FSO = CreateObject("Scripting.FileSystemObject")
Set OutPutFile = FSO.OpenTextFile( sFolder & "\" & dirname & "\" & rutare & ".txt" ,8 , True)
OutPutFile.WriteLine(FormatDateTime(Now, vbGeneralDate) & vbtab & networkInfo.UserName & vbtab & networkInfo.ComputerName)
OutPutFile.close
Set FSO= Nothing
commmand = "C:\GS\gswin32c.exe -dNOPAUSE -dBATCH -sDEVICE=jpeg -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dJPEGQ=100 -r600 -sOutputFile=" & chr(34) & sFolder & "\" & dirname & "\p%%02d.jpeg" & chr(34) & " " & chr(34) & sFolder & "\" & oFile.Name & chr(34)
ots.writeline "@echo -----------------------------------------------------------------------------"
ots.writeline "@echo Procesare - " & oFile.Name
ots.writeline "@echo -----------------------------------------------------------------------------"
ots.writeline commmand
End if
Next
if nn=0 then
ots.writeline "@echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
ots.writeline "@echo Nu exista PDF uri sau cu extensia " & crit
ots.writeline "@echo Pentru toate PDF-urile se selecteaza No!"
ots.writeline "@echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
end if
ots.writeline "timeout 6"
objShell.run "%comspec% /c " & tmpfile,1, True
ots.close
ffso.deletefile tmpfile,true
set ffso=nothing
Set oFSO = Nothing