Rename XML file with PDF file name

Post Reply
Posts: 23
Joined: Thu Aug 06, 2020 1:36 pm

Rename XML file with PDF file name

Post by schmitzdp » Thu Aug 06, 2020 4:44 pm


I want to use the "NameProper" of my PDF and rename my XML file with it before forwarding them to "Pickup XML".

Here's an example.



Do you know the way to do this operation? Tool "Rename Job", Scripting Module ?

Thank you.

Advanced member
Posts: 609
Joined: Thu Feb 09, 2012 3:53 pm

Re: Rename XML file with PDF file name

Post by freddyp » Thu Aug 06, 2020 7:24 pm

Put the two files in a folder and in "XML Pickup" use "Pickup mode - Metadata in job folder asset". The name of the XML does not matter in that case.

How do you get the two files in a folder?
"Assemble job" with "Scheme - Custom" and "Number of files - 2".

How do you make sure it is the correct two files that are assembled, assuming that multiple files with different names will be coming in at the same time? Well, make sure that you have something that identifies both files uniquely and use that to fill in "Job identifier" of "Assemble job". Considering the file names you have given there is the number 3476 that is present in both and that is probably unique. If you now put 3476 in a piece of private data with the name "id" (for example) you can use that as the "Job identifier". Adding a piece of private data is something you can do on any folder, so for the PDF that would be:
and for the XML:

And after that you dismantle the job again and throw away the XML. No scripting required.

With a script it is shorter in terms of the number of elements you have to use to solve the problem, but you have to know how to do it. Here is the principle: in timerFired you get the list of waiting jobs with s.getJobs(). You loop over that list to find two that belong together, a PDF and an XML. You create a dataset, copy the XML path to the path of the dataset, attach the dataset to the PDF job, send it to output, send the XML to null.

Post Reply