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: Создание PDF файлов из группы файлов (JPG) 
Author Message
Flasher



PostPosted: Tue Nov 22, 2011 02:46    Post subject: Reply with quote

Code:
'====================================================================================
' Сконвертировать выделенные графические файлы в один PDF с именем активного каталога

' Важно: если выбран только один файл, то конвертироваться будут все файлы
' c поддерживаемыми расширениями, расположенные в корне активного каталога

' Параметры: "<путь к редактору>" "<путь источника>" "<путь получателя>" %L
' Пример:    "%%COMMANDER_PATH%%\Utils\JPEGtoPDF.exe" "%P" "%T" %L
'====================================================================================
With WScript.Arguments
  If .Count = 0 Then WScript.Quit
  Edit = .Item(0)
  Path = .Item(1)
  Targ = .Item(2)
  List = .Item(3)
End With
If Right(Targ, 1) <> "\" Then Targ = Targ & "\"

Set D = CreateObject("Scripting.Dictionary")
For Each Ext in Split("BMP,GIF,JPG,JPEG,JP2,J2K,PNG,TIF,WMF,EMF", ",")
  D.Add Ext, ""
Next
With CreateObject("Scripting.FilesystemObject")
  Name = .GetFileName(Path)
  N = Name
  Const M = 1
  Do While .FileExists(Targ & Name & ".pdf")
    l = l + 1
    If l < 10^M Then PostFix = Right(String(M, "0") & l, M) Else PostFix = l
    Name = N & " (" & PostFix & ")"
  Loop
  Temp = Split(.OpenTextFile(List).ReadAll, vbNewLine)
  If UBound(Temp) = 1 Then
    For Each F in .GetFolder(Path).Files
      If D.Exists(Ucase(.GetExtensionName(F))) Then Pars = Pars & " """ & F & """"
    Next
  Else
    For Each F in Temp
      If F > vbNullString Then
        If D.Exists(Ucase(.GetExtensionName(F))) Then Pars = Pars & " """ & F & """"
      End If
    Next
  End If
  CreateObject("WScript.Shell").Exec Edit & " """ & Targ & Name & ".pdf""" & Pars
End With
Set D = Nothing
WScript.Quit
JPEGtoPDF

Last edited by Flasher on Wed Nov 23, 2011 04:15; edited 5 times in total
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group