I have a litiitle script to collect PDFs and merge it to one PDF file. Once in a while PDFTK crashes and I get the message:
PDFTK has stopped working. And then I have two choices one is close the program and there is another option, which I can't remember right now.
My question is, is it possible to catch an exit-code and with the result of that code to restart over the funtion again, until there is a good result without failure.
How do I do that? Thanks in advance!
Code: Select all
collectPDFs()
{
Loop, Files, M:\HNG\_Shared\Breng-Planning\muurkranten\Muurkranten + Opkomststaten 308 en 151\AutoModus\*.*
{
FileGetTime, OutputVar, M:\HNG\_Shared\Breng-Planning\muurkranten\Muurkranten + Opkomststaten 308 en 151\AutoModus\*.*, M
FormatTime, DateCreated, %A_LoopFileTimeCreated%, dd-M-yyyy
FormatTime, CurrentDateTime,, dd-M-yyyy
if (CurrentDateTime = DateCreated)
{
PDF_IN = "%A_LoopFileFullPath%"
PDF_IN_Total .= PDF_IN A_Space
}
}
PDFKT_Path := "H:\Settings\Desktop\AutoHotkey_1.1.33.10\PDFTK\App\pdftkbuilder\pdftk.exe"
DateTomorrow := Add_Days_to_CurrentDate_ShortDate(1)
NewFile := "M:\HNG\_Shared\Breng-Planning\muurkranten\Muurkranten + Opkomststaten 308 en 151\AutoModus\" . "_Alle-PDFs-Samen-" . DateTomorrow . "_.pdf"
RunWait, %comspec% /c ""%PDFKT_Path%" %PDF_IN_Total% "output" "%NewFile%"", , hide
}