Page 1 of 1

Importing pdfs and adding keywords from pdf title

Posted: Fri Feb 22, 2019 3:25 pm
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!

Re: Importing pdfs and adding keywords from pdf title

Posted: Fri Feb 22, 2019 5:59 pm
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

Re: Importing pdfs and adding keywords from pdf title

Posted: Fri Feb 22, 2019 7:58 pm
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.

Re: Importing pdfs and adding keywords from pdf title

Posted: Sat Feb 23, 2019 12:20 pm
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.

Re: Importing pdfs and adding keywords from pdf title

Posted: Sat Feb 23, 2019 3:00 pm
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?

Re: Importing pdfs and adding keywords from pdf title

Posted: Sat Feb 23, 2019 3:36 pm
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

Re: Importing pdfs and adding keywords from pdf title

Posted: Sun Mar 03, 2019 7:54 pm
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

Re: Importing pdfs and adding keywords from pdf title

Posted: Thu Mar 07, 2019 12:56 am
by MjRNeuro
Thank you, this works perfectly!! You've made my transition to Bookends much better. :D

Re: Importing pdfs and adding keywords from pdf title

Posted: Thu Mar 07, 2019 3:24 am
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

Re: Importing pdfs and adding keywords from pdf title

Posted: Thu Mar 07, 2019 10:24 am
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...

Re: Importing pdfs and adding keywords from pdf title

Posted: Thu Mar 07, 2019 10:56 am
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