James Scott-Brown home about

Recording PDFs read in Skim

I have a large number of reference PDFs, only some of which I have actually referred to.

I wanted a quick way to record which I had referred to, when, and why, in a single text file that I could easily review or grep through.

My solution was the following Applescript, which I associated with a keyboard shortcut using Quicksilver’s Triggers feature.

tell application "Skim"
	set page_no to current page of document 1
end tell
display dialog "Description" default answer "p." & (index of page_no)
set the str_descr to the text returned of the result

tell (current date) to get (it's year as integer) & "-" & (it's month as integer) & "-" & day
set str_date to the result as text

tell application "Skim"
	set str_pdf to name of document 1
end tell

set str_details to (str_date) & "	" & str_pdf & "	" & str_descr & return
set file_name to (((path to home folder) as string) & "PDFs Read")

set the file_name to the file_name as string
set the open_target_file to open for access file file_name with write permission
write str_details to the open_target_file starting at eof
close access the open_target_file

When run, this identifies the file in the Skim window that currently has focus, brings up a dialog prompting for a comment (pre-filled with the page number), then appends a line formatted as <date>\t<filename>\t<comment> to a text file named “PDFs Read” in your home directory.

blog comments powered by Disqus