Character counts
Klaus Mueller
mueller23 at web.de
Thu Nov 30 05:18:50 PST 2006
Hello Michael,
> Pgf.Text.Count option - it gives different value than
> if I do File>Utilities>Document Reports>Asian Charater Count
Does your document contain double byte characters?
Do you run FrameMaker with an Asian system locale?
- You need to ensure that your paragraph loop does
only process paragraphs on body pages.
- Note that you need to count characters in text lines
separately.
- The FM command does not count spaces, tabs, en spaces,
soft hyphens etc. - Pgf.Text.Count does.
Set vWhiteSpace = ' '+CharTab+4S+9S+16S+17S+18S+19S+20S;
//-- Note: This "#S" notation works with FS3 and later.
Set vDoc = ActiveDoc;
Set vCharCountAll = 0;
Set vCharCountPlain = 0;
//-- Loop through paragraphs:
Loop ForEach(Pgf) In(vDoc) LoopVar(vPgf)
If (vPgf.Page.ObjectName = 'BodyPage')
Set vPgfText = vPgf.Text;
Set vCharCountAll = vCharCountAll + vPgfText.Count;
Get String FromString(vPgfText) NewVar(vPgfText)
RemoveChars(vWhiteSpace);
Set vCharCountPlain = vCharCountPlain + vPgfText.Count;
EndIf
EndLoop;
//-- Loop through text lines:
Set vGraphic = vDoc.FirstGraphicInDoc;
Loop While(vGraphic)
If (vGraphic.ObjectName = 'TextLine')
If (vGraphic.Page.ObjectName = 'BodyPage')
Set vPgfText = vGraphic.Text;
Set vCharCountAll = vCharCountAll + vPgfText.Count;
Get String FromString(vPgfText) NewVar(vPgfText)
RemoveChars(vWhiteSpace);
Set vCharCountPlain = vCharCountPlain + vPgfText.Count;
EndIf
EndIf
Set vGraphic = vGraphic.NextGraphicInDoc;
EndLoop
Display 'Character Count: '+ vCharCountPlain
+' ('+vCharCountAll+') ';
Kind regards,
Klaus Müller, itl AG
--- Original Message ---
From: Michael Zaichenko
Date: 30.11.2006 10:05
> Hello Klaus,
> I'm scripting something that involves character count of
> the file. I have noticed that if I use Pgf.Text.Count option -
> it gives different value than if I do File>Utilities>Document
> Reports>Asian Charater Count. Do you know how to retrieve the
> correct value. I was not able to find a FrameScript option for it.
> Thanks in advance.
> Michael
More information about the framers
mailing list