Skip to content

Instantly share code, notes, and snippets.

@kmlawson
Last active December 18, 2015 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmlawson/5801900 to your computer and use it in GitHub Desktop.
Save kmlawson/5801900 to your computer and use it in GitHub Desktop.
Very simple pdf word count in Skim PDF reader using AppleScript. Assumes file you want word count for is open.
-- This is a really stripped down and simple version of
-- Daniel Shockley's DocInfo, which I had trouble getting
-- to work on pandoc converted unicode files.
-- Thanks to him for the original script:
-- DocInfo (for Skim)
-- version 1.0, Daniel A. Shockley, http://www.danshockley.com
-- http://www.danshockley.com/files/DocInfo.scpt
tell application "Skim"
set docName to name of document 1
set docText to get text for document 1
set selText to get text for selection of document 1
set docWords to count of words of docText
display dialog "Total words: " & docWords
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment