Count words in OS 10.3?

I’ve been using applescript in OS 9 for awhile. When I try to use some of these scripts in OS 10, they don’t work. One simple script I need is : count the words in a text document. I’d like to find some simple scripts of this type so I can modify some of my OS 9 scripts.

Thanks for any help.

We would need more information to determine why your classic scripts aren’t working in OS X. How are you calling them, what applications are you scripting, etc.

set f to choose file -- get a text file

set s to read f -- copy its contents into memory

set x to count every word of s -- the number of words

I was using the script below with Scriptable Text Editor to count
characters in an open document. I changed Scriptable Text Edtor to
Script Editor, but that does not do the trick. The program with the
open window is inTextEdit application.

tell application “Script Editor”
count characters of document 1

end tell

If I were copy this script into a Script Editor document and tell it
to work on a Text Edit document, would that work?

Thanks for comments.

I meant to reply to your post directly.

I don’t understand the script. What is “f”? What does “choose file” mean?

The script below is based on a script I downloaded as 74000.

The script worked when I first created it. But when I open it and try to use it on an open document, it just gets some kind of error.

tell application “AppleWorks 6”
set S to count of words of front document
log (S)
set C to count of characters of front document
log (C)
display dialog “The number of words =” & S
display dialog “The number of characters =” & C

end tell

What’s wrong?