Running the following works fine with one PDF in the folder:
Code: Select all
Loop, Files, %A_Desktop%\MyFolder\*.pdf
Run %comspec% /c pdftk "%A_Desktop%\Folder2\Ins.pdf" "%A_LoopFileFullPath%" cat output "%A_Desktop%\MyFolder\TEST.pdf" "dont_ask", , hide
ExitApp
The PDF I want to use in the folder will always be named something like Smith, John Ledger 06-21-2021 so I'm assuming it would make since to look for the Ledger 06-21-2021 portion of the file name using something like RegExMatch.
I'm not exactly sure of the best way to do this. I'm assuming something like:
Code: Select all
Loop, Files, %A_Desktop%\MyFolder\*.pdf
If the PDF file name is in this format → Smith, John Ledger 06-21-2021 do this
Run %comspec% /c pdftk "%A_Desktop%\Folder2\Ins.pdf" "%A_LoopFileFullPath%" cat output "%A_Desktop%\MyFolder\TEST.pdf" "dont_ask", , hide
ExitApp
Else
FileSelectFile, SelectedFile, 3, %A_Desktop%\MyFolder, Select PDF, PDF Docs (*.pdf)
Run %comspec% /c pdftk "%A_Desktop%\Folder2\Ins.pdf" "%SelectedFile%" cat output "%A_Desktop%\MyFolder\TEST.pdf" "dont_ask", , hide
ExitApp