Importing pdfs and adding keywords from pdf title

A place for users to ask each other questions, make suggestions, and discuss Bookends.
Post Reply
MjRNeuro
Posts: 6
Joined: Fri Feb 22, 2019 12:59 pm

Importing pdfs and adding keywords from pdf title

Post by MjRNeuro »

I've been storing my pdfs separately from my reference manager. I've just adopted Bookends and need to import thousands of pdfs and create references for each. I've been using the Mac OS 'Find' function to search for files based on keywords I've already typed into each pdf's title. But to maintain that searching ability, I need those keywords after I've imported the pdf into Bookends.

When I import a pdf, is there any way to automatically have Bookends look at the title of the pdf and add each word in the title (or ideally, each word between two parentheses in the title) into the keywords section? This would save me hundreds of hours of having to type them in manually for each pdf.

Suggestions appreciated!

Jon
Site Admin
Posts: 8986
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Importing pdfs and adding keywords from pdf title

Post by Jon »

No, Bookends won't try to parse text from a PDF and put it in fields. Note that Bookends also uses Spotlight to search for PDFs (check out the Find dialog, Command-F). You search for just the PDF words, or combine the Spotlight search with a database search. Spotlight searches are restricted to PDFs in the default attachment folder.

Jon
Sonny Software

msteffens
Posts: 35
Joined: Thu Jul 19, 2007 10:04 am
Location: Germany
Contact:

Re: Importing pdfs and adding keywords from pdf title

Post by msteffens »

MjRNeuro wrote:
Fri Feb 22, 2019 3:25 pm
When I import a pdf, is there any way to automatically have Bookends look at the title of the pdf and add each word in the title (or ideally, each word between two parentheses in the title) into the keywords section?
Hi MjRNeuro,

based on your description I think that the newly added scripting capabilities in Bookends 13.2 could help you here. I could try to write a script for you. But I'd need a representative amount of sample PDF file names, and how exactly the resulting keyword fields should look like after conversion.

MjRNeuro
Posts: 6
Joined: Fri Feb 22, 2019 12:59 pm

Re: Importing pdfs and adding keywords from pdf title

Post by MjRNeuro »

Hi msteffens,

I was thinking that scripting would be required - if you could write a script for this, it would be incredibly helpful!!

A few example names:

Banyai...Singer etal '19 (VCx correlation neural coding).pdf
Chen & Baram '16 (dev stress cognitive review).pdf
Caras & Sanes '19 (ACx dev perceptual learning variable).pdf
Azzopardi etal '18 (ASR PPI mechanism ACh PPT rat).pdf

Each of the words within the parentheses are key words. I think they'd need to be on separate lines in the keyword field within Bookends to be searchable properly. In the few cases where two words form one keyword, I'm ok with them being separated if it'll save me the work to type them in.

MjRNeuro
Posts: 6
Joined: Fri Feb 22, 2019 12:59 pm

Re: Importing pdfs and adding keywords from pdf title

Post by MjRNeuro »

Hi Jon,
You wrote: Note that Bookends also uses Spotlight to search for PDFs (check out the Find dialog, Command-F). You search for just the PDF words, or combine the Spotlight search with a database search. Spotlight searches are restricted to PDFs in the default attachment folder.
This doesn't seem to work for me. My default folder for attachments is iCloud folder for iOS Sync (I set this in Preferences). When I use Spotlight search by typing into Spotlight text, it doesn't find text within the titles of pdfs that are imported and stored in that folder. Any thoughts?

Jon
Site Admin
Posts: 8986
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Importing pdfs and adding keywords from pdf title

Post by Jon »

Bookends Spotlight searches are for content, not the file name (when you mentioned title in your query I that that's what you meant -- the article's title, not the PDF file name).

Jon
Sonny Software

msteffens
Posts: 35
Joined: Thu Jul 19, 2007 10:04 am
Location: Germany
Contact:

Re: Importing pdfs and adding keywords from pdf title

Post by msteffens »

MjRNeuro wrote:
Sat Feb 23, 2019 12:20 pm
if you could write a script for this, it would be incredibly helpful!!
Hi MjRNeuro,

I've written a script for you that should do what you want:

For all publications contained in the group chosen from your frontmost Bookends library window, this script will take the first attachment of each publication, extract the part of the attachment name that's enclosed with parentheses, and add all of its words as individual publication keywords.

I've posted the script in the scripting-related forum:

Sample script: Update publications from attachment name

Caveats:
- I'm not using macOS Mojave (10.14) yet, so I'm not sure if it works with Mojave's automation security. But you should be able to open the script's code in "Script Editor" app, and run it from there (or save it as a new script/app).
- The script doesn't display any progress info yet (I plan to add this soon, though). In any case, you may want to try the script with just a few publications first.
- Please see also the ReadMe for the script.

Before running the script, please create a new group with all the publications you'd like to process. Then run the script, and choose your group's name within the script's dialog.

Hope this helps. Let me know if it doesn't work for you.

Matthias

MjRNeuro
Posts: 6
Joined: Fri Feb 22, 2019 12:59 pm

Re: Importing pdfs and adding keywords from pdf title

Post by MjRNeuro »

Thank you, this works perfectly!! You've made my transition to Bookends much better. :D

msteffens
Posts: 35
Joined: Thu Jul 19, 2007 10:04 am
Location: Germany
Contact:

Re: Importing pdfs and adding keywords from pdf title

Post by msteffens »

MjRNeuro wrote:
Thu Mar 07, 2019 12:56 am
Thank you, this works perfectly!! You've made my transition to Bookends much better. :D
Hi MjRNeuro,
you're welcome, I'm glad to hear that the script worked for you!
Matthias

iandol
Posts: 357
Joined: Fri Jan 25, 2008 2:31 pm

Re: Importing pdfs and adding keywords from pdf title

Post by iandol »

Matthias, even though I won't use this script, thank you for such well documented code; it is really helpful to see well written Applescript examples...

msteffens
Posts: 35
Joined: Thu Jul 19, 2007 10:04 am
Location: Germany
Contact:

Re: Importing pdfs and adding keywords from pdf title

Post by msteffens »

iandol wrote:
Thu Mar 07, 2019 10:24 am
Matthias, even though I won't use this script, thank you for such well documented code; it is really helpful to see well written Applescript examples...
Hi iandol,
many thanks for the kind words! I'm happy the script is useful beyond its original purpose.
Matthias

Post Reply