Total Commander Forum Index Total Commander
Форум поддержки пользователей Total Commander
Сайты: Все о Total Commander | Totalcmd.net | Ghisler.com | RU.TCKB
 
 RulesRules   SearchSearch   FAQFAQ   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Single Post  Topic: Печать перечня файлов 
Author Message
Flasher



PostPosted: Sat Oct 11, 2014 12:02    Post subject: Reply with quote

Набросок по данной заявке (не проверял):
Code:
'========================================================================================================
' Разнести файлы по маске на 3 принтера без повторной печати

' Условие: путь запуска - пустой

' Параметры: "<путь к log.файлу>" <маска 1> <маска 2> <маска 3> "<принтер 1>" "<принтер 2>" "<принтер 3>"
' Пример: C:\Print\Log.txt *-Тит.pdf *-А4.pdf *-А3.pdf "Xerox Printer" "Samsung Printer" "Epson Printer"
'========================================================================================================

With WScript.Arguments
  If .Count <> 7 Then
    MsgBox "Должно быть указано 7 параметров!", 48, Space(28) & "Печать файлов"
    WScript.Quit
  End If : PrintLog = .Item(0)
  Filters  = Array(.Item(1), .Item(2), .Item(3))
  Printers = Array(.Item(4), .Item(5), .Item(6))
End With

Set mPrinters = CreateObject("WScript.Network").EnumPrinterConnections
Set Dict = CreateObject("Scripting.Dictionary")

For Pr = 1 to mPrinters.Count Step 2 : Dict.Add mPrinters(Pr), Null : Next
For Each Pr in Printers
  If Not Dict.Exists(Pr) Then ErrList = ErrList & vbNewLine & Pr : s = s + 1 : End If
Next
If s > 0 Then
  If s > 1 Then PFix = "ы"
  MsgBox "Принтер" & PFix & " не найден" & PFix & ":" & ErrList, 48, Space(17) & "Печать файлов"
  WScript.Quit
End If

Set SHA = CreateObject("Shell.Application")
CD = CreateObject("WScript.Shell").CurrentDirectory
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.FileExists(PrintLog) Then ReadLog = FSO.OpenTextFile(PrintLog,,,-1).ReadAll

For i = 0 to Ubound(Filters) - 1
  Set Items = SHA.NameSpace(CD).Items
  Items.Filter 192, Filters(i)
  If Items.Count Then
    For Each F in Items
      If Not InStrRev(ReadLog, F) Then
        SHA.ShellExecute F.Path, """" & Printers(i) & """", _
        FSO.GetParentFolderName(F) & "\", "printto", 0
        FSO.OpenTextFile(PrintLog, 8, True, -1).WriteLine Now & "  " & F.Path
      End If
    Next
  End If
Next

_________________
Автору сборки TC Image (Andrey_A) настоятельно рекомендуется не распространять на иных ресурсах любую предоставленную мной где-либо техническую информацию по автоматизации и оптимизации в работе с ТС и системой.
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group