 |
 |
Apple Script to count characters in TextEdit
|
 |
|
 |
|
Professional Poster
Join Date: Feb 2002
Location: adequate, thanks.
Status:
Offline
|
|
Anyone knows how to mak an Apple Script that counts the characters in TextEdit? I have almost no clue how to do this, although I know Apple Script can be very simple to learn... Oh, I'm lazy... 
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Jan 2002
Location: London, UK
Status:
Offline
|
|
Originally posted by andreas_g4:
Anyone knows how to mak an Apple Script that counts the characters in TextEdit? I have almost no clue how to do this, although I know Apple Script can be very simple to learn... Oh, I'm lazy...
Nope, but I do know of a Service that offers this as one of many features:
WordService
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: May 2001
Status:
Offline
|
|
Use "wc" in the terminal to count the number of lines, words, and bytes in a text file.
-
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Apr 2001
Location: europe
Status:
Offline
|
|
tell application "TextEdit"
set theText to the text of the document 1
set theCharCount to the length of the theText
display dialog "The text of the document \"" & (the name of the window 1) & "\" contains " & theCharCount & " characters." buttons {"OK"}
end tell
|
|
Nasrudin sat on a river bank when someone shouted to him from the opposite side: "Hey! how do I get across?" "You are across!" Nasrudin shouted back.
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Apr 2001
Location: europe
Status:
Offline
|
|
This one shouldn't count whitespace:
tell application "TextEdit"
set theText to the text of document 1
set theWordCount to the count of words of theText
set theCharCount to 0
repeat with i from 1 to the theWordCount
set theCharCount to theCharCount + the (length of the word i of theText)
end repeat
display dialog "The text of the document \"" & (the name of the window 1) & ¬
"\" contains " & theWordCount & " words and " & theCharCount & " characters." buttons {"OK"}
end tell
|
|
Nasrudin sat on a river bank when someone shouted to him from the opposite side: "Hey! how do I get across?" "You are across!" Nasrudin shouted back.
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Oct 2001
Location: Yokohama, Japan
Status:
Offline
|
|
tell original poster
topic is not "Mac OS X"
move topic to "Software"
end tell
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Apr 2001
Location: europe
Status:
Offline
|
|
wataru, AppleScript is part of the system in my opinion (as is TextEdit).
(Last edited by Developer; Feb 14, 2003 at 02:10 PM.
)
|
|
Nasrudin sat on a river bank when someone shouted to him from the opposite side: "Hey! how do I get across?" "You are across!" Nasrudin shouted back.
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: May 2001
Status:
Offline
|
|
... but TextEdit isn't
-
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|