I have Adobe Distiller, tried to run similar command as PDFtk, but without success...
Code: Select all
RunWait, %COMSPEC% /C distiler.exe %InputVar%\*.pdf cat output %OutputVar%\combined.pdf, , hide
Code: Select all
Gui, Add, Text, x25 y10 w170 h20 , Select INPUT folder
Gui, Add, Button, x12 y30 w120 h30 , INPUT
Gui, Add, Button, x22 y65 w100 h30 , Cancel
Gui -SysMenu
Gui, Show, w140 h110, PDFMerge
return
ButtonINPUT:
FileSelectFolder, InputVar, , 4 ;Select a source folder
;Count and display the number of files in the source folder for info
count=0
Loop,%InputVar%\*.pdf,0,1
files:=(files ? "`n" : "") . A_LoopFileFullPath,count:=count+1
MsgBox % "Found " count " PDF files`nNow select the OUTPUT folder."
FileSelectFolder, OutputVar, , 4 ;Select a destination folder
Gui, submit ;Save the selected folders to their associated variables
;MsgBox pdftk %InputVar%\*.pdf cat output %OutputVar%\combined.pdf ;Use MsgBox to test output to commandline
Run %comspec% /c pdftk %InputVar%\*.pdf cat output %OutputVar%\combined.pdf, , hide ;Pass the parameters to pdftk and hide the commandline window on completion
Gui, Destroy ;Close the first GUI so it doesn't muck up the progress bar
;~ ;Create a second GUI showing looping progress bar
;~ ;('cos merging 800 to 2000 PDF's can take several minutes)
;~ ;Credit to polyethene for the progress bar routine
;~ ;http://www.autohotkey.com/community/viewtopic.php?t=13469)
Gui, Add, Progress, vlvl -Smooth 0x8 w350 h18 ; PBS_MARQUEE = 0x8
Gui, Show, , Merging PDF's... Please wait...
SetTimer, Merging, 45
Return
Merging:
GuiControl, , lvl, 1
Process, Exist, pdftk.exe, ;Check for pdftk
If Errorlevel
Return
SetTimer, Merging, Off ;turn off process timer
Gui, Destroy ;close the second GUI
MsgBox, 64, PDFMerge, Finished! Your merged file is in %OutputVar% ;Inform user that merge process has finished
Run, %OutputVar% ;Open the destination folder to show file
ExitApp
ButtonCancel:
ExitApp
Esc::ExitApp ;Use the Esc key to exit app