Created
October 4, 2018 12:08
-
-
Save quantixed/b20eeb68af7a8e62d27e6c6dfc297e0c to your computer and use it in GitHub Desktop.
AppleScript to get word and character count from TextEdit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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