Need To Rename PDF Files Medical Manuscripts Which Come To Me With Numbers Only Using Automator

Been trying and it is hit and miss.

Does anyone have a true way to do this?

~Medical Manuscript Arrives with name 3989765.pdf

~We know it has metadata

Need to rename file name based on metadata.

Tried over 30 arrangements in Automator and, zilch.

Thank you, Patrick

Mac Pro, macOS 10.14

Posted on Mar 28, 2020 8:44 AM

Reply

Similar questions

10 replies

Mar 29, 2020 9:26 AM in response to pcarrington

Do you let these PDF accumulate in your Downloads folder, or do you ad hoc move them to another folder, where there may be sub-folders representative of various organizational naming categories (e.g. Disease or drug or whatever)?


Automator has a PDF library action named Get PDF Metadata where you can select the Title (and nothing else), or also tell it to write input filename too. When you select a PDF, it is passed into the Get PDF Metadata action, and the results of the latter action are 1) the PDF filename, and 2) the title string — both as list items.


The action following the Get Metadata, just needs to know the order of those list items, and use the Title to rename the PDF file that is also passed into it.




Mar 28, 2020 9:54 AM in response to pcarrington

What specific metadata do you want to rename a given PDF?


From Dock : Launchpad : Other, open Script Editor.


Copy and paste the following into the Script Editor, click the hammer icon, and then click run. It will display all of the document Attributes as metadata in a dialog as shown in the subsequent image.


use framework "Cocoa"
use framework "Quartz"
use AppleScript version "2.4" -- Yosemite 10.10 or later
use scripting additions

property NSURL : a reference to current application's NSURL
property PDFDocument : a reference to current application's PDFDocument

set apdf to POSIX path of (choose file of type "com.adobe.pdf" default location (path to desktop))

set furl to NSURL's fileURLWithPath:apdf
set pdf to PDFDocument's alloc()'s initWithURL:furl
set pdf_vers to pdf's majorVersion() & "." & pdf's minorVersion()

set pdf_attrib to pdf's documentAttributes()
set key_array to pdf_attrib's allKeys() as list
set val_array to pdf_attrib's allValues() as list
set out_fmt to "Pages : " & pdf's pageCount & return & "Vers  : " & pdf_vers & return

repeat with i from 1 to count of key_array
	set out_fmt to out_fmt & "Key    : " & (item i of key_array) & return & "Value : " & (item i of val_array) & return
end repeat
display dialog out_fmt
return




Mar 29, 2020 8:45 AM in response to pcarrington

Patrick,


Are these PDF medical manuscripts stored in a folder, or a folder hierarchy containing sub-folders? When you say "Arrive" — explain the process by which you want to process these PDF. Renaming them in place is simple enough using the PDF Title metadata, but how the PDF are accessed is important. What fall back approach should be taken if the Title metadata field is empty?

Mar 29, 2020 8:55 AM in response to VikingOSX

These come from QXRead. QXRead offers 'abstracts' and if I wish to receive the manuscript from my medical library at the University with which I"m affiliated, then I can select to do so. Then it downloads via my 'browser' Safari into my Downloads folder. That is why they often start with something like "09343456543.pdf" or similar. That is what I wish to make with Automator:something that will extract the TITLE ONLY from the metadata (IF it is in the metadata and I'm aware that not all pdf files may have it) and rename the file so then I can catalog and group them according to Disease or Drug or whatever. I've tried Automator and can't seem to get it to work consistently. Thank you for your attention. Patrick

Mar 29, 2020 2:41 PM in response to VikingOSX

Thank you- I have them in a QXRead Folder stored in Dropbox because I access QXRead from several computers as well as iOS devices. I have made the very same Automator you sent (thank you) and on my computers it was inconsistent. Maybe it's something with my setup on Mojave or whatever. I even emailed Sal (Automator Guru) to no answer. I appreciate your thoughts. Will keep trying. Patrick

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Need To Rename PDF Files Medical Manuscripts Which Come To Me With Numbers Only Using Automator

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.