I am trying to get automator to merge PDF pages from two files with similar names.
Right now I already have a service workflow in automator that is able to merge two selected files:
While this workflow is certainly useful, I still have to manually select the files to be merged one by one. Also, the resulting file name is being renamed with an apparently random string of letters after the set words.
I will mainly use this script for getting numbered files (ex: 10989.pdf) merged with files containing those numbers, with names like "lst009010989.pdf". Those files are all in a folder with various other files with names following the same system, so what I need is for the workflow to get the numbered files and join them to their respective lst file, copy it to another folder while maintaining the numbered file name (in this case, 10989) and then doing the same for the other files in the folder.
How am I able to do this?
Additional information: The first page of the merged file should always be the one of the numbered file (10989 in the exemple). The second one should be the one of the LST file. The resulting file should be named NF_LST xxxxx.pdf (xxxx being the name of the numbered file, 10989 in this case).
The lst filename always starts with lst and has 14 characters, the last of them always being the same as the numbered file name. The numbered filename changes from 3 characters to 6.
The following image shows what a typical folder contains: