This is properly possible to do with the scriptable Skim.app.
After looking at this: Skim / Wiki / SkimNotes_Tool
I decide to do it little different.
- Make text note, hightlight text… in Skim and save your PDF
- Run the AppleScript below
It will create skim notes (format: RTF) of your PDF in the same folder as your PDF.
set skimCommand to "/Applications/Skim.app/Contents/SharedSupport/skimnotes "
set skimParameters to "get -format rtf "
set thePath to getPathOfFrontDocument()
do shell script skimCommand & skimParameters & thePath
on getPathOfFrontDocument()
tell application "Skim"
return its path of front document
end tell
end getPathOfFrontDocument
And if we like to highlight text inside PDF in Skim and later run script to extract its content
(**
* [allNotesFromFrontDocument]
*)
-- its allNotesFromFrontDocument()
on allNotesFromFrontDocument()
tell application "Skim"
set noteObjects to note of front document
set {idx, noteList} to {1, {}}
repeat while idx ≤ (noteObjects's length)
set the end of noteList to text of (item idx of noteObjects) as string
set idx to idx + 1
end repeat
return noteList
end tell
end allNotesFromFrontDocument
(**
* [notesFromPageNumber(integer pageNumber)]
*)
its notesFromPageNumber(1)
on notesFromPageNumber(pageNumber)
tell application "Skim"
tell page pageNumber of front document
set noteObjects to its notes
set {idx, noteList} to {1, {}}
repeat while idx ≤ noteObjects's length
set the end of noteList to text of (item idx of noteObjects) as string
set idx to idx + 1
end repeat
return noteList
end tell
end tell
end notesFromPageNumber