Clipboard action not working

Papers is very AppleScriptable, however its object model is a bit arcane and lacking some basic things like the selection.

This will work ONLY if the front document is open and NOT in a library-viewer-window-preview – AND if there is only 1 highlight.

tell application "Papers"
  set displayedPub to displayed publications of front library window
  
  if length of displayedPub = 1 then
    set displayedPub to item 1 of displayedPub
  else
    error "Number of documents!"
  end if
  
  tell displayedPub
    set displayedPubOriginalPath to original path of its primary file item
    set docCiteKey to its citekey
  end tell
  
  set theHighlightItem to first highlight item where its source file's original path is displayedPubOriginalPath
  tell theHighlightItem to set highlightText to its source text
    
end tell

highlightText & linefeed & linefeed & docCiteKey

As far as I can tell there is NO way to determine if a highlight is selected.

I’m reasonably impressed with their AppleScript Getting Started Page:

http://support.mekentosj.com/kb/tutorials/scripting-papers-3-for-mac-with-applescript-a-getting-started-guide

-Chris