Script to change a paratag based on the autonumber format

Scott Prentice sp14 at leximation.com
Fri Mar 6 09:58:52 PST 2015


OK .. couldn't resist. Try this ..

--------------------
var doc = app.ActiveDoc;
// these para tags must already exist
var pgfFormat1 = doc.GetNamedObject(Constants.FO_PgfFmt, "listitem1");
var pgfFormat2 = doc.GetNamedObject(Constants.FO_PgfFmt, "listitem2");

if ((!pgfFormat1.ObjectValid()) || (!pgfFormat2.ObjectValid())) {
     alert("Para tags must exist!");
}
else
{
     var pgf = doc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;

     while(pgf.ObjectValid() == true)
     {
         var autonum = pgf.AutoNumString + "";
         if (autonum.length > 0) {
             if (autonum.substring(0, 3) == "•\\t") {
                 var props = pgfFormat1.GetProps();
                 pgf.SetProps(props);
             }
             else if (autonum.substring(0, 3) == "o\\t") {
                 var props = pgfFormat2.GetProps();
                 pgf.SetProps(props);
             }
         }
         pgf = pgf.NextPgfInFlow;
     }
}
--------------------

Cheers!
...scott
On 3/6/15 9:28 AM, Scott Prentice wrote:
> Hi Yves...
>
> The answer to your questions is .. Yes!  :-)
>
> If you're looking for the code to do it, that might take a bit more 
> time. Some generous developer might post the code for you, I'll 
> provide some pseudo-code ..
>
> - iterate each paragraph in the document
> - check the autonumber format value ..
> - if autonum string starts with "•\t" .. assign the "listitem1" para tag
> - if autonum string starts with "o\t" .. assign the "listitem2" para tag
>
> This should actually be pretty simple .. I just can't do it right now. 
> If no one else does, I might though.  :o
>
> Cheers,
> ...scott
>
>
>
> On 3/6/15 5:07 AM, Yves Barbion wrote:
>> Hi group
>>
>> I've got a FrameMaker file which was converted from a Word document. 
>> The FrameMaker file contains the paratag [List Paragraph] but this 
>> tag is also used by "nested" bulleted lists. Consequently, the 
>> autonumber format is as follows:
>>
>> •\t for top-level list items
>> o\t for second-level list items
>>
>> Is there a way to rename the paratag based on the autonumber format, 
>> for example:
>>
>> rename [List Paragraph] with the •\t autonumber format to [listitem1]
>> rename [List Paragraph] with the o\t autonumber format to [listitem2]
>>
>>
>> Thanks
>>
>> -- 
>> Yves Barbion
>> www.scripto.nu <http://www.scripto.nu>
>>
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.frameusers.com/pipermail/framers-frameusers.com/attachments/20150306/ae916d36/attachment.htm>


More information about the framers mailing list