Автор: smirnvlad
Дата сообщения: 20.11.2010 21:50
bdfy
насчет "и т.п" не знаю, а pdf,doc,docx так
[more=VBScript]
printall.vbs
Код: [no]
Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(WshShell.CurrentDirectory)
Set files = folder.Files
Set sfiles = CreateObject("System.Collections.ArrayList")
exts = LCase("doc,docx,pdf")
For each folderIdx In files
name = folderIdx.Name
extt = Split(name, ".")
ext = LCase(extt(UBound(extt)))
if InStr(1, exts, ext) > 0 then
sfiles.add name
end if
Next
sfiles.Sort()
acrobat = """C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe"" /n /s /o /h "
WshShell.Run acrobat & ""
Set objWord = CreateObject("Word.Application")
For each name In sfiles
extt = Split(name, ".")
ext = LCase(extt(UBound(extt)))
if InStr(1, LCase("doc,docx"), ext) > 0 then
Set objDoc = objWord.Documents.Open(fso.BuildPath(folder, name))
objDoc.PrintOut()
objDoc.Close()
elseif InStr(1, LCase("pdf"), ext) > 0 then
acr = acrobat & " /t "
acr = "cmd /c "" start """" /wait " & acr & """" & fso.BuildPath(folder, name) & """" & " """
WshShell.Run acr, 7, true
end if
Next
objWord.Quit
[/no]