home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Bila Vrana
/
BILA_VRANA.iso
/
028A
/
AUROR.ZIP
/
COUNTWRD.AML
< prev
next >
Wrap
Text File
|
1996-07-17
|
1KB
|
42 lines
//--------------------------------------------------------------------
// COUNTWRD.AML
// Count Words, (C) 1993-1996 by nuText Systems
//
// This macro counts the number of words in the current file and
// displays the result. The count is limited to a marked block if it
// exists.
//
// Words are defined to be contiguous sequences of alphabetic characters
// of mixed case, and the underline (_) character.
//
// Usage:
//
// Select this macro from the Macro List (on the Macro menu), or run it
// from the macro picklist <shift f12>.
//--------------------------------------------------------------------
// compile time macros and function definitions
include bootpath "define.aml"
// test for edit windows
if not wintype? "edit" then
msgbox "Edit windows only!"
return
end
// test if a marked block exists in the current file
block_count = mark? and getmarkbuf == getcurrbuf
// display message
say "Counting words" + (if? block_count " in block") + "..."
// count words using regular expression searching
count = find "[a-zA-Z_]#" "axg" + (if? block_count 'b')
// clear the title bar
display
// display the word count
shortbox (if? count (thousands count) "No") + " words found" +
(if? block_count " in the block")