Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Grabbing notes from PDFs
(*
Script courtesy of Walton Jones, modified slightly
http://drosophiliac.com/2012/09/an-academic-notetaking-workflow.html
Original script by John Sidiropoulos
http://www.organognosi.com/export-skim-notes-according-to-their-highlight-colors/
*)
tell application "Skim"
set the clipboard to ""
set numberOfPages to count pages of document 1
activate
set myColorCodes to my chooseColor()
set firstPage to "1" as number
set lastPage to numberOfPages
set the clipboard to "# Notes #" & return & return
repeat with currentPage from firstPage to lastPage
set pageNotes to notes of page currentPage of document 1
exportPageNotes(pageNotes, currentPage, myColorCodes) of me
end repeat
end tell
on exportPageNotes(listOfNotes, pageForProcessing, myColorCodes)
tell application "Skim"
set currentPDFpage to pageForProcessing
repeat with coloredNote in listOfNotes
repeat with i from 1 to the count of myColorCodes
if color of coloredNote is item i of myColorCodes then
set categoryColors to ({"Summary", "Methods", "Arguments", "Reference", "Thesis", "Question or connection"})
set noteColor to color of coloredNote as string
if noteColor is item i of myColorCodes as string then
set noteColor to item i of categoryColors
end if
set noteText to get text for coloredNote
set the clipboard to (the clipboard) & "**[" & noteColor & "]" & "(file://" & name of document 1 & "#page=" & pageForProcessing & ")**" & ": " & return & noteText & return & return
end if
end repeat
end repeat
end tell
end exportPageNotes
on chooseColor()
set selectedColors to ({"Summary", "Methods", "Arguments", "Reference", "Thesis", "Question or connection"})
set colorCodes to {}
set noteColor to ""
repeat with noteCol in selectedColors
set noteColor to noteCol as text
if noteColor is "Summary" then
set end of colorCodes to {64634, 900, 1905, 65535}
else if noteColor is "Methods" then
set end of colorCodes to {64907, 32785, 2154, 65535}
else if noteColor is "Arguments" then
set end of colorCodes to {65535, 65531, 2689, 65535}
else if noteColor is "Reference" then
set end of colorCodes to {8608, 65514, 1753, 65535}
else if noteColor is "Thesis" then
set end of colorCodes to {8372, 65519, 65472, 65535}
else if noteColor is "Question or connection" then
set end of colorCodes to {64587, 1044, 65481, 65535}
end if
end repeat
return colorCodes
end chooseColor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.