Rename files based on content

A picture is worth a thousand words. We have created some pdfs tutorials showing common tasks.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Post Reply
Ocasio
User
Posts: 10
Joined: Thu Oct 17, 2019 3:06 pm

Rename files based on content

Post by Ocasio »

Good morning everyone.

Ive been trying to look for a way to do this everywhere, I found once a script and I lost it.

I want to rename .pdf files based on content inside them

For example, if the .pdf file has a

this.getField("Text1").value
and
this.getField("Text3").value

I want the file to be renamed to

"Text1"&"Text3"

Example

"Text1" = Joe
"Text3" = 1984

Then, rename file as "Joe 1984"

The .js file I found was external, the explanation I saw was that it cannot be done with a javascript inside the .pdf since you cannot rename a file while using it.

Thanks in advance for the help.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17823
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Rename files based on content

Post by Tracker Supp-Stefan »

Hello Ocasio,

Did you find that script on our website/forum, or on a third party's website?
Indeed renaming the file while it is open with JS inside the file itself is not really an option, but you may be able to save a copy of that file with the new name. Have you tried such a script?

Kind regards,
Stefan
Ocasio
User
Posts: 10
Joined: Thu Oct 17, 2019 3:06 pm

Re: Rename files based on content

Post by Ocasio »

I forgot where I found it but I know it was a forum, not this one. But I remember it has a .pdf and an external .js file

Both options, save while open to another file or rename a closed file are useful to me.

If you could help me out with both of those, I would appreciate thanks.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17823
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Rename files based on content

Post by Tracker Supp-Stefan »

Hello Ocasio,

If you manage to find the script - you can give it a try with the /runjs command line parameter that the Editor supports:
https://help.pdf-xchange.com/pdfxe ... ns_ed.html

Kind regards,
Stefan
Post Reply