Skip to content

Instantly share code, notes, and snippets.

@quantixed
Created October 4, 2018 12: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 quantixed/b20eeb68af7a8e62d27e6c6dfc297e0c to your computer and use it in GitHub Desktop.
Save quantixed/b20eeb68af7a8e62d27e6c6dfc297e0c to your computer and use it in GitHub Desktop.
AppleScript to get word and character count from TextEdit
tell application "TextEdit"
set wc to count words of document 1
set cc to count characters of document 1
if wc is equal to 1 then
set txt to " word, "
else
set txt to " words, "
end if
if cc is equal to 1 then
set txtc to " character."
else
set txtc to " characters."
end if
set result to "This text comprises " & (wc as string) & txt & (cc as string) & txtc
display dialog result with title "WordStats" buttons {"OK"} default button "OK"
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment