Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jsmm/7128724 to your computer and use it in GitHub Desktop.
Save jsmm/7128724 to your computer and use it in GitHub Desktop.
--2011-06-10
--http://organognosi.blogspot.com/
tell application "Skim"
set the clipboard to ""
set numberOfPages to count pages of document 1
activate
set myColorCodes to my chooseColor()
display dialog "Do you want to export all the notes or some of them?" buttons {"All", "Some"} default button 1
set answer to button returned of the result
if answer is "All" then
set firstPage to "1" as number
set lastPage to numberOfPages
set the clipboard to "Skim notes" & return
else
display dialog "Give the number of the first page." default answer ""
set firstPage to text returned of the result as number
display dialog "Give the number of the last page" default answer ""
set lastPage to text returned of the result as number
end if
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 noteText to get text for coloredNote
set the clipboard to (the clipboard) & noteText & return & return
end if
end repeat
end repeat
end tell
end exportPageNotes
on chooseColor()
set selectedColors to (choose from list {"Destacado", "Resumen", "Citable/Definición", "Pregunta/Referencia", "Técnica/Método", "Resultado/Interpretación"} with prompt ("Choose the color of notes for exporting (you can select multiple colors):") default items {"Destacado"} with multiple selections allowed)
set colorCodes to {}
set noteColor to ""
repeat with noteCol in selectedColors
set noteColor to noteCol as text
if noteColor is "Destacado" then
set end of colorCodes to {65535, 65531, 2689, 65535}
else if noteColor is "Resumen" then
set end of colorCodes to {52428, 65535, 26214, 65535}
else if noteColor is "Citable/Definición" then
set end of colorCodes to {26214, 65535, 65483, 65535}
else if noteColor is "Pregunta/Referencia" then
set end of colorCodes to {52428, 52428, 52428, 65535}
else if noteColor is "Técnica/Método" then
set end of colorCodes to {65260, 52435, 26213, 65535}
else if noteColor is "Resultado/Interpretación" then
set end of colorCodes to {26214, 65535, 26214, 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