Skip to content

Commit 574ad67

Browse files
committed
Now gracefully handles papers with missing PDFs
1 parent aadca81 commit 574ad67

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed
Binary file not shown.

Papers3/Papers_To_Bookends/Papers_To_Bookends.applescript

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- Papers to Bookends
2-
-- version 1.3, licensed under the MIT license
2+
-- version 1.4, licensed under the MIT license
33

44
-- by Matthias Steffens, keypointsapp.net, mat(at)extracts(dot)de
55

@@ -195,7 +195,16 @@ on exportToBookends(pubList, risRecordList)
195195
set bookendsImportInfo to ""
196196

197197
set aFile to primary file item of aPub
198-
if aFile is not missing value then -- export file & metadata
198+
set exportFile to false
199+
if aFile is not missing value then
200+
set missingPDF to (full path of aFile is "" or full path of aFile is missing value)
201+
if not missingPDF then
202+
set exportFile to true
203+
else
204+
KeypointsLib's logToSystemConsole(name of me, "PDF is missing for publication \"" & pubName & "\", importing metadata only...")
205+
end if
206+
end if
207+
if exportFile then -- export file & metadata
199208
set fileName to formatted file name of aFile
200209
if fileName is missing value then
201210
KeypointsLib's displayError("Couldn't get file name!", "The file at \"" & filePath & "\" could not be found.", 15, true)
Binary file not shown.

Papers3/Papers_To_Bookends/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ For more info, please see [MIT license](https://github.com/extracts/mac-scriptin
6060

6161
## Release Notes
6262

63+
### v1.4
64+
65+
* Now gracefully handles papers whose primary PDF is missing from your Papers library: Instead of throwing an error, the script now ignores the missing PDF and just imports the publication metadata into Bookends.
66+
6367
### v1.3
6468

6569
* Now requires the KeypointsScriptingLib v1.2 (or greater) which works around an AppleScriptObjC bug in macOS 10.13.0 (High Sierra) where `current application's NSNotFound` is returning the wrong value.

0 commit comments

Comments
 (0)