TextEdit Word Count?
Hi folks, I'm relatively new to Apple. (New enough to not know the proper forum for this question, though). Can I do a word count in TextEdit? If so, how? Any help is greatly appreciated.
Here is the applescript to tell you the word count:
tell application "TextEdit"
set WordCount to the number of words in the the front document
display dialog "The wordcount is: " & WordCount
end tell
What you need to do to install this is this:
Run the program called "Scripteditor", which you can find somewhere in the programs directory - there is no point in my trying to tell you where as my system is set up in Foreignspeak. You'll have to run a search, which thankfully is very easy!
To make a new script press apple-n, then copy and paste the text I gave above into the window that appears. Then run the script and it will tell you how many words there are in your current TextEdit file.
There is probably a neater way of running the script than opening ScriptEditor, but given that I have been playing with this stuff for only a very short period of time I don't know about it yet.
Best Wishes, Max
p.s. My favourite script of the moment, which speaks whatever I type:
set toSay to "I would like a cup of tea."
repeat
set toSay to the text returned of (display dialog "Max doeth speak:" default answer toSay)
say toSay
end repeat
(childish, I know!)
Mac OS X (10.4.3)
Similar Messages
-
Textedit-word counting.
Using textedit in writing and I want to check how many words I wrote. Anyone know how to do it in Textedit.?
Copy and paste this Applescript into Script Editor and save as an Application. Run it to display the word count of the frontmost document:tell application "TextEdit"
set theName to name of document 0
set wordCount to the number of words in document 0
display dialog "There are " & wordCount & " words in document '" & theName & "'"
end tell -
TextEdit experts, plug-in/bundle for word count?
Hello,
Can someone please tell me if there is any plug-in/bundle for TextEdit that will provide a file's word count?
Asking the question in this forum because I think many Pages users would be knowledgeable about TextEdit.
Thanks.Download and install the free WordServices from Devon Technolgy.
It offer a service entitled Statistics which deliver the same kind of infos than the identical function embedded in Pages.
An other scheme is to download install one of the free text editors from third party like :
Bean
iText Express
Yvan KOENIG (VALLAURIS, France) vendredi 15 juillet 2011 21:11:32
iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8
Please : Search for questions similar to your own before submitting them to the community
To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer ! -
Hi, is there a way to make a script that will always show the word count in TextEdit? If so, how do I make it? Can the script show word count while typing? Apple should consider adding word count to TextEdit.
Thanks,
SarahAnother stunning answer from Bang.
There's no inherent way of doing this. The closest you can get is an idle script that continually (or, at least, periodically, polls the front document, counts the words and displays it in some manner.
The main issue you'll have is how to display it in a non-intrusive way (e.g. you don't want to pop up a dialog box every few seconds). Here's one idea that kind of hacks it together, by putting the word count into a background window:
tell application "TextEdit"
global WordCountDoc
make new document -- make a new doc
set WordCountDoc to id of window 1 -- remember it
set WordCountWindow to window 1 -- find its window
set bounds of WordCountWindow to {20, 100, 200, 200} -- and reposition it
set ActualDocument to make new document -- here's the real doc we're going to count
end tell
on idle
global WordCountDoc
tell application "TextEdit"
set wordCount to 0 -- assume an empty document
try
set wordCount to (count (words of (text of document of front window)))
end try
set text of (document of window id WordCountDoc) to (wordCount as text)
end tell
return 10 -- check again in 10 seconds
end idle
Save it as a 'stay open' script and launch it when you're ready.
It's certainly not as elegant as a 'true' word count built into the application (e.g. it polls every n seconds rather than counting as you type), but it gives you a start. -
Is there a word count for Pages 08? If so, how do I see it or view it?
PeterBreis0807 wrote:
But Yvan I had to teach you how to do that.
You had to teach me that quotes are required for Preview under 10.5 because I don't use 10.5 !
In fact I don't use Preview because I prefer Adobe Reader which displays my docs a better way.
here Preview under 10.5
here Adobe Reader (10.4 and/or 10.5)
More to the point is that if the Word Count function is in a logical location, why are so many unable to find it without resorting to searches of the manual?
Because most of them doesn't search seriously.
But, even it the location was odd, it's not normal that they ask here before searching in the Help AND in the PDF User Guide.
The forum is not a catch all questions recipient.
The Help and terms of use clearly urges them to search in the delivered resources.
These resources are:
(1) the menus themselves
(2) the Inspectors themselves
(3) the Help
(4) the PDF User Guide which is delivered with every copy of iWork, on disk or in downloaded versions
(5) last not least, in the existing threads.
For my own use, I searched in the Help and in the PDF because I was surprised to read users claiming that they didn't found the info.
Doing that, I discovered that what _I got in the Edit menu_ is also available in an Inspector in which I had never searched as I was already able to get the tool in the menu.
When I searched in the Help I found nothing useful.
When I searched in the PDF, as I am running 10.4, Preview and Adobe Reader gave the response instantaneously.
You wrote here that under 10.5, Preview behaves differently.
I checked and in my response I wrote that quotes may be required.
Last not least, searching in the existing threads give also the response immediately.
So, from my point of view, if we continue to read the question here it's only because many users think _"why would I make the effort to search by myself when there will be some one which will give the response on the forum"_ . In other words, lazyness is becoming the rule.
Yvan KOENIG (from FRANCE mercredi 24 septembre 2008 17:28:05) -
I've just got the newest version of pages.
The word count includes everything, from titles to endnotes - including the numbers in my sub-headings.
I used to use open office where you could select a style i.e. 'body tex't, and get a word count that didn't include every single word in a document.
Is there a way of doing something similar, or reseting the word count to only 'body text' so I know exactly how long my essays are?
Thanks.Unfortunately, no version of Pages has this fine-grained control over document components and their word count, so the answer is no, regarding user changeable settings.
Programmatically, I just told AppleScript to count the words of body text in a currently opened Pages v5.2 document. The count matched the Pages word count for the document. So, no solution there either. -
I am new to the wonderful world of Mac and all of my documents were created in MS Word on my old laptop. I noticed that the word counts were slightly different when I opened the documents in Word for Mac, but then I noticed that they changed drastically. For intance, I opened a document today and after the initial period where the word count shifts, it seemed to settle on 13,171. I left the document for a while to work on some other things and when I came back the word count had changed to 11,677. I didn't do anything to the document. Word counts are important to me since I need at least 60,000 for my PhD Dissertation. Which word count should I trust?
Since Word is a Microsoft product, you should probably post your question on the Microsoft Mac forums:
http://answers.microsoft.com/en-us/mac -
I have been using Acrobat for converting PDF documents to Word. It had been working just fine, but lately, when I convert a PDF document to Word, it is not giving me the word count, which is why I subscribed in the first place. Someone has any idea of why?
Hi Robin,
I would recommend you to use Acrobat software to convert this pdf file, Acrobat software enable you to customize the conversion settings.
You can download a free 30-day trial from this Link : https://helpx.adobe.com/acrobat/kb/acrobat-downloads.html
After downloading and installing acrobat, Open pdf file in Acrobat, go to File menu -> Click 'save as other' -> Microsoft Word -> Word Document.
A pop-up window will appear that would prompt you to choose the file to be converted, after you select the file, click on the settings button on the bottom left of the pop-up window and choose 'Retain Page layout' under layout settings, click ok and then save.
Hope that helps with your query.
Regards,
Rahul -
Putting Word Count in Pages Document
Is there a way to insert a document's current word count directly into the body of the document? In other words, is there a way to do the equivalent of "Insert Page Number" or "Insert Page Count" for word count?
PeterBreis0807 wrote:
See *How to Insert Current Weather and Word Count into Your Document* p307 in the Pages09_UserGuide.pdf downloadable from under the Help menu.
Peter
It's dificult to read page 307 in a guide containing 266 pages.
On page 37 I may read how to view word count and other document statistics but,
- I saw nothing about current weather
- I saw nothing about a way to insert the word count in the document as it was asked by the OP
As far as I know,
we may insert page num, page count, date time, file name
but we only
may display word count.
Yvan KOENIG (from FRANCE mercredi 27 mai 2009 18:21:12) -
How do you get word count to print at the end of a document in Pages?
How do you get word count to print at the end of a document in Pages?
Pages v5 does not provide a user assignable word count variable. With some AppleScript, and a paste operation from the clipboard, you can have locale punctuated word count in this format: 7,803 — anywhere in your document. The following AppleScript works with Pages '09 v4.3 through Pages v5.5.2 on Yosemite.
I would suggest that you copy paste the following AppleScript into your [Apple] Script Editor and save it (suggestion) wordcnt.applescript. Then, follow this with an option+Save As… and this time set the File format to Script Bundle, or Application with hidden extension — saved to your Desktop. Provided you have a Pages document open, you are then a double-click from the ability to paste your current word count into Pages.
Note: If you have Pages word count display enabled, it will automatically count your pasted value as another word which initially may deceive on true word count at the time the script was run.
AppleScript
--- copy below this line ---
property locale : "en_US.UTF-8" -- In Terminal, use the locale command to see yours
if not ApplicationIsRunning("Pages") then
display dialog "Pages must be running to use this utility."
return quit
end if
tell application "Pages"
tell body text of front document
set wordCnt to count words
-- Don't want punctuated numbers? Remove the single quote from printf format
set the clipboard to (do shell script "export LC_ALL=" & locale & "; printf \"%'d\" " & wordCnt)
end tell
end tell
on ApplicationIsRunning(appName)
tell application "System Events" to set appNameIsRunning to exists (processes where name is appName)
return appNameIsRunning
end ApplicationIsRunning -
Can you do a Word Count in Pages?
I am working on College essays and applications and a lot of the essays they require you to write can only be so many words. Is there a way to do a word count on Pages? On my PC, Microsoft Word 07 automatically has the word count in the bottom of the window.
Please help!In the inspector there is an automatic word count in the document section. All you need to do is select the info column and it should be there!
John -
Indesign CS6 Total Document Word Count... No?
I left the following comment on a Youtube tutorial explaining how to execute a word count query for an Indesign document ASSUMING your article layout uses a single box of text:
What if an article uses a creative layout with multiple text-boxes? Are you supposed to get out your pocket calculator and add them up one-by-one?
I work for a magazine that publishes short, submission-style testimonials bridged together with staff-generated narrative copy; some of our articles use six or more discreet text-boxes. You REALLY MEAN TO TELL ME that there is NO WAY to yield a TOTAL DOCUMENT WORD COUNT using what is SUPPOSED TO BE the MOST ADVANCED page layout application ON EARTH??
Pardon my exasperation in the above comment, but....Seriously?
I need someone knowledgeable to please look me in the eyes and tell me, "This is true", before I am going to be able to let myself believe it.
Thank you.
- Exasperated Journalist SlagYes, there are ways, just not what you expected.
One approach to counting words in multiple text frames in InDesign is to thread them together. To maintain the pieces of text in their assigned threaded text frames, you can create a paragraph style that starts in the next frame, and assign it to the first paragraph in each text frame. Or, you can break the threads when the count is stable.
If the text frames need to adjust their size to the amount of their content, search Google for terms like "indesign auto resize text frame" without quotes for details.
There was a recent discussion about auto-resizing text frames that mentioned the free AutoFit InDesign plug-in, from typefi.com. Search Google for terms like "indesign typefi autofit" for details.
Search Google for terms like "threading and unthreading InDesign text frames" without quotes, for details.
Search Google for terms like "indesign start paragraph in next frame" without quotes, for details.
You can file a formal feature improvement request here: Wishform.
HTH
Regards,
Peter
Peter Gold
KnowHow ProServices
evanexempt wrote:
I left the following comment on a Youtube tutorial explaining how to execute a word count query for an Indesign document ASSUMING your article layout uses a single box of text:
What if an article uses a creative layout with multiple text-boxes? Are you supposed to get out your pocket calculator and add them up one-by-one?
I work for a magazine that publishes short, submission-style testimonials bridged together with staff-generated narrative copy; some of our articles use six or more discreet text-boxes. You REALLY MEAN TO TELL ME that there is NO WAY to yield a TOTAL DOCUMENT WORD COUNT using what is SUPPOSED TO BE the MOST ADVANCED page layout application ON EARTH??
Pardon my exasperation in the above comment, but....Seriously?
I need someone knowledgeable to please look me in the eyes and tell me, "This is true", before I am going to be able to let myself believe it.
Thank you.
- Exasperated Journalist Slag -
Word count and my ActionPerformed
I am having a little trouble with my program and was wondering if anyone could spot the mistake... I am trying to make a simple application that will count the number of words in a text field via click of a button and display the results.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
public class WordCount extends JFrame implements ActionListener
// added JTextPane, JScrollPane, JPanel JTextField, and JButton
public static void main(String[] args)
// layout
public WordCount()
super();
Container cp = getContentPane();
wordCount.setEditable(false);
south.setLayout(new FlowLayout(FlowLayout.CENTER));
south.add(jbtCount);
jbtCount.addActionListener (this);
south.add(new JLabel(" Word Count: "));
south.add(wordCount);
cp.add(BorderLayout.CENTER,jsPane);
cp.add(BorderLayout.SOUTH,south);
public void actionPerformed(ActionEvent e)
//if(e.getSource() == jbtCount) // user clicks Count Words Button
Object s = e.getSource();
if ( s instanceof Button )
jtPane.setDocument(new DefaultStyledDocument() {
public void insertString(int offset, String str, AttributeSet as) throws BadLocationException
super.insertString(offset,str,as);
String text = jtPane.getText();
String[] tokens = text.split(" ");
wordCount.setText("" + countValid(tokens));
public void remove(int offset, int len) throws BadLocationException
super.remove(offset,len);
String text = jtPane.getText();
String[] tokens = text.split(" ");
wordCount.setText("" + countValid(tokens));
else{}
} // end actionPerformed
private int countValid(String[] tokens)
int count = 0;
for (int i = 0; i < tokens.length; i++)
if (tokens.trim().length() != 0)
count++;
return count;
} // end public class WordCountimport java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
public class WordCount extends JFrame implements ActionListener
JTextPane jtPane = new JTextPane();
JScrollPane jsPane = new JScrollPane(jtPane);
JPanel south = new JPanel();
JTextField wordCount = new JTextField(20);
JButton jbtCount = new JButton("Count Words");
public static void main(String[] args)
int width = 700;
int height = 300;
WordCount f = new WordCount();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(width, height);
f.setTitle("Word Counter");
f.setLocation(200, 200);
f.setVisible(true);
public WordCount()
super();
Container cp = getContentPane();
wordCount.setEditable(false);
south.setLayout(new FlowLayout(FlowLayout.CENTER));
south.add(jbtCount);
jbtCount.addActionListener (this);
south.add(new JLabel(" Word Count: "));
south.add(wordCount);
cp.add(BorderLayout.CENTER,jsPane);
cp.add(BorderLayout.SOUTH,south);
public void actionPerformed(ActionEvent e)
//if(e.getSource() == jbtCount) // user clicks Count Words Button
Object s = e.getSource();
// *** process Button actions
if ( s instanceof Button )
jtPane.setDocument(new DefaultStyledDocument() {
public void insertString(int offset, String str, AttributeSet as) throws BadLocationException
super.insertString(offset,str,as);
String text = jtPane.getText();
String[] tokens = text.split(" ");
wordCount.setText("" + countValid(tokens));
public void remove(int offset, int len) throws BadLocationException
super.remove(offset,len);
String text = jtPane.getText();
String[] tokens = text.split(" ");
wordCount.setText("" + countValid(tokens));
else{}
}// end actionPerformed
private int countValid(String[] tokens)
int count = 0;
for (int i = 0; i < tokens.length; i++)
if (tokens.trim().length() != 0)
count++;
return count;
} // end public class WordCount -
Problem with getting word count in TLF text
Hi,
I want to get the word count from my TLF text, but the problem is that I am not being able to handle th case for space.
I am using the findNextWordBoundary property of ParagraphElement as shown below:
private function countWords( para : ParagraphElement ) : void
var wordBoundary:int = 0;
var prevBoundary:int = 0;
while ( wordBoundary != para.findNextWordBoundary( wordBoundary ) )
// If the value is greater than 1, then it's a word, otherwise it's a space.
if ( para.findNextWordBoundary( wordBoundary ) - wordBoundary > 1)
wordCount += 1;
prevBoundary = wordBoundary;
wordBoundary = para.findNextWordBoundary( wordBoundary );
// If the value is greater than 1, then it's a word, otherwise it's a space.
if ( wordBoundary - prevBoundary > 1 )
var s:String = para.getText().substring( prevBoundary, wordBoundary );
lenTotal += s.length;
Now I have 2 issues here:
If my string is for eg: Hi, I am writing in "TLF". And I want to get its word count then
1) Suppose I take the case of the string Hi, . Then para.getText().substring( prevBoundary, wordBoundary ) gives the text as Hi i.e without the comma. Same case for the string "TLF forums" , It treats each " as a single word and not the whole "TLF" as a single word. Why doesn't it compute till spaces, that should be the ideal case. So until we don't give a space it should count the whole thing as a word.
2) So now the problem is I have applied a condition if ( wordBoundary - prevBoundary > 1 ) to check if it is a space i.e. if the diff is <= 1 it is a Space. But if I use this I miss out on single words. Like for eg if I have "Hi, This is a string" ,then 'a' is ignored too.
Now I could have added a check here along with the space check that the string between prevBoundary and wordBoundary is " "(i.e a space), Then also it is a problem as then the single words like a,&,I will be ignored.
So, now I am stuck with this issue and need some help from you guys.
ThanksfindNextWordBoundary is not going to serve your purpose. I'd propose doing something like this:
// didn't test this but something like this - whitespace matches any set of 1 or more white space characters
static const whiteSpaceRegExp:RegExp = /[u0020|u000A|u000D]*/
public static function countWords( para : ParagraphElement ) : void
return para.getText().split(whiteSpaceRegExp).length;
A good list of everything considered whitespace extracted from the unicode space can be found here:
http://sourceforge.net/adobe/tlf/svn/449/tree/trunk/textLayout/src/flashx/textLayout/utils /CharacterUtil.as
In function createWhiteSpaceObject
Hope that helps,
Richard -
Ich habe folgende Frage: Ist es mit inDesign CS6 möglich, ein interaktives PDF zu kreieren, in dem die zulässige Wortzahl in einem Feld genau definiert wird?
Im speziellen Fall möchte ich ein Eingabefeld auf eine DIN A4 Seite setzen, welches exakt 350 Wörter erfordert, um die Seite druckbar zu machen... Mehr Wörter sollten nicht eingegeben werden können und sollten es weniger sein, ist ein Drucken nicht möglich...
I have the following question: Does InDesign CS6 offer am option to create an interactive PDF with a text/form field which allows ONLY a defined number of words?
In this particular case I would like to create a DIN A4 page with a file dwhich allows for exactly 350 words to make the document printable. If one put's in less than 350 printing should be disallowed and at the same time it should be impossible to type more than the allowed number of words.
Jörg Hippo ThomsenHi Steve!
Thanks to a google search I have managed to solve the issue flawlessly
Look at this little java script:
var val = event.value + event.change,
matches = val.match(/\b[\w\-\']+\b/g),
count = matches.length;
this.getField("charCount").value = count;
if (count > 90) { app.alert("You have exceeded the maximum of 90 words for this text field.") }
1. This script needs to be inserted under Properties/Format/Custom/Custom Key Stroke Script.
2. One creates a second fiield namend charCount to display the word count.
Voila! The text field will pop up a warning if the allowed maximum word count is exceeded and it will display the word count in the extra field
Maybe you are looking for
-
How can I recover an old/disused iCloud account. I was having some issues with my apple id so I restored my iPad, I am now stuck on the activation screen as I no longer use the iCloud account i used to set up the iPad and can't remember the address o
-
ive been getting these pop ups for a wyle now. its starting to really worry me! im not super new to mac. i know that you have to empty the trash. i have also used different types of free programs because i dont want to waist my money on one. they hel
-
I tried exporting the PDF . It it worked at some points along the process of making the document, but once I completed the document, it is no longer able to create a PDF. I did a whole lot of searching online and some people say it might have to do
-
Hi, in my script I am trying to read the Date and Time using the XMP functions of a selected file in bridge. Then, I want to convert that date and time into a format that looks like: "01/12/10 | 01:23 PM" and write that to another metadata field lik
-
MacBook A1181 Question and Emergency.
Hello. My Uncle gave me his MacBook A1181 three days ago with a problem. I've read some forums online and my problem is that the MacBook had an overheat problem. What happened was my uncle was using it and all of a sudden it shut off completely, and