|
Download
LINECNTR.ZIP (v1.02;
01/11/08; 9965 bytes)
Compatible
with WordPerfect versions 9,10,11,12,X3
WordPerfect 11
users: See important information about using macros in the first
release of WP11 (11.0.0.233) at the top of this
page.
Downloading,
Documentation, Modifications, and Support |
Here is a WordPerfect 9+ macro that counts all lines in the current document's
body text area (including table rows) that have text in them
(i.e., alphanumeric characters). Note that it does not
count lines that contain only punctuation, space characters,
or graphics/text boxes, since these are not normally considered
"lines."
You may have noticed that WordPerfect
has a built-in line counter, of sorts. You can go to the top
of a document and use Format, Line, Numbering, then check "Turn
line numbering on," and un-check both "Restart numbering
on each page" and "Count blank lines." This gives
line numbering in the left margin, with the last numbered line
showing what is in effect the total number of lines. When you
no longer need it, delete the [Ln Num] code from the Reveal Codes
window.
However, the LineCounter.wcm
macro shows a message onscreen that gives
- the total line count;
- the total number of lines (i.e.,
some lines may be blank or contain just spaces or punctuation
marks);
- a word count;
- a line count based on the traditional
65 characters (including spaces) per line.
There is no menu. Just play the
macro in your document and it will count the lines in it.
Be sure to
play the macro again if you edit or reformat the document, or
if you select or use a different printer. These may cause the number of lines
to change. With respect to printers, WordPerfect makes heavy
use of Windows printer drivers to format text, which in turn
can cause slight differences in document formatting if the document
is automatically or manually reformatted for a different printer.
Note that WordPerfect's Format,
Line, Numbering line count will include a count of any
text box/graphic image on a line, as well as lines with nothing
by space characters or punctuation marks in them. This macro
does not count these items as 'text' lines unless they include
alphanumeric characters on the same line. (However, the "traditional"
65 characters-per-line method mentioned above does include
spaces.)
|
Some thoughts about line count
accuracy
Line counting in the old "typewriter
days" was easier than it is today. You could depend on material
in the lines not moving, since what you typed was immediately
set firmly on paper. With computers, you have a choice between
using typewriter-like monospaced fonts and typeset-like proportional
fonts. The latter can produce problems when you try to count
lines to get an accurate total.
Using a proportional font means
that if you select a different printer (File, Print, <printer name>)
or load the document on a different system with a different printer
attached, the new Windows printer driver can (and most likely
will) change the number of lines slightly due to inter-letter
and inter-word spacing adjustments.
Furthermore, in WordPerfect there
is a setting in Tools, Settings, Environment that forces WordPerfect
to reformat documents (when opening them) to the current default
printer's specifications. This will surely make minor changes
to the line count on larger documents. Hence, WordPerfect will
adjust lines to fit the new printer driver specifications. [This
frequently happens with documents faxed from inside WordPerfect.
The Windows (or fax software) fax driver -- much like a printer
driver -- wraps words to suit its format requirements. As a result,
a 'one-page fax' created in WordPerfect can run over onto the
next page when faxed. This is a good reason to preview faxes
before sending them!]
Al of this is accomplished automatically
in WordPerfect using printer metrics (i.e., measurements).
According to the WordPerfect Help file (which section does not apply
to WordPerfect 8 and earlier versions):
". . . By default, WordPerfect
determines line endings through printer metrics. If you will
be moving a document between different printers often, you may
wish to prevent the document from reformatting every time you
change printers. You can do this by disabling printer metrics.
When you disable printer metrics, WordPerfect determines line
endings by display metrics.
To disable printer metrics (in
WP9 and later versions): 1.
Click Tools, Settings.
2. Click Convert.
3. Click the Compatibility tab.
4. In the Options section, enable the "Don't use printer
metrics to format document" (or in WP10+, "Do not format
document using printer metrics") check box.
Note: If you disable printer
metrics, printer fonts will not be visible in your list of fonts."
This setting uses a 1200 dpi
(dots per inch) 'virtual printer,' and then sends the document
to the physical printer formatted to match the screen display
pagination. This process effectively removes reformatting / repagination
problems.
So line count 'accuracy' is relative,
depending on several factors and system settings. If the line
count is made on the same system and the same printer
where the document was physically printed, there should be no
problem or discrepancy. However, it the line count is done first
(for invoicing a client, as a transcriptionist might do), and
the .WPD file is then sent to a client who prints it on their
own system, the client might find that the line count is off
a bit.
I can't see any way around that,
other than to send a hard copy with the built-in line count feature
turned on, showing line numbers in the left margin. (To use this
feature, go to the top of a document and use Format, Line, Numbering,
then check "Turn line numbering on," and un-check both
"Restart numbering on each page" and "Count blank
lines." This gives line numbering in the left margin, with
the last numbered line showing what is in effect the total number
of lines. When you no longer need it, delete the [Ln Num] code
from the Reveal Codes window.)
I think a word count is a more
accurate means of measuring production. But I see lots of people
on the Corel newsgroups and elsewhere trying to find ways to
quickly and accurately count lines in a document, so there must
be a need for this. Hence, the reason I wrote the LINECNTR macro.
See the Disclaimer
at the bottom of this page, which is particularly applicable
if you depend on absolute accuracy in line counts. |
Programming notes:
- You could use SelectLineEnd
in place of the first two commands (SelectMode(On!) And PosLineEnd)
in the macro's main Repeat loop. However, in WP10 and later,
a new checkbox exists in Tools, Settings, Environment: "Use
WP9 text selection." If this is left un-checked (the shipping
default), it will change the way SelectLineEnd (and several other
selection and cursor movement commands) works compared to WP9
and earlier versions. The method used in this macro circumvents
this potential problem.
- You can use the values stored
in vCount, vTotCount, and vWordCount to print a report.
|
Page
Top |
Disclaimer:
All materials, including any software or software code contained
herein, or that may be found on a related Internet site are offered
without warranty or guarantee of any kind, either express or
implied, including but not limited to implied warranties of merchantability,
satisfactory quality, fitness for a particular purpose, non-infringement,
or those arising by law, statute, usage of trade, course of dealing
or otherwise, and are provided on an "as is," and "with
all faults" basis. The entire risk as to the results and
performance of these materials or software is assumed by you.
The author assumes no liability whatsoever to you or any other
entity or third party for any special, incidental, direct, indirect,
or consequential damages -- including without limitation any
damages to equipment, or for loss of profits, for business interruption,
for loss of data or other information, or for any other loss
arising out of the use or inability to use these materials, techniques,
suggestions, or software programs, even if the author has been
notified of the possibility or actuality of such damages, or
they are foreseeable. Materials herein have been prepared with
reasonable care for educational and informative purposes. No
representations are made regarding the use or the results of
the use of any materials contained herein in terms of their correctness,
accuracy, reliability, or otherwise, and you are again cautioned
that you use them solely at your own risk. You are advised to
make backups of any important files before implementing any materials,
including any macro, suggestion, tip, method, technique, or other
item contained herein. |