Re: Script to change a paratag based on the autonumber format
Hi Scott! Yes! Your script works beautifully! Thank you very much. So, I guess I owe you a beer (or a lunch) at tekom tcworld in Stuttgart (I hope you can wait that long)? Cheers! Yves On Fri, Mar 6, 2015 at 6:58 PM, Scott Prentice s...@leximation.com wrote: 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 ___ You are currently subscribed to framers as yves.barb...@gmail.com. Send list messages to framers@lists.frameusers.com. To unsubscribe send a blank email to framers-unsubscr...@lists.frameusers.com or visit http://lists.frameusers.com/mailman/options/framers/yves.barbion%40gmail.com Send administrative questions to listad...@frameusers.com. Visit http://www.frameusers.com/ for more resources and info. -- Yves Barbion www.scripto.nu ___ You are currently subscribed to framers as arch...@mail-archive.com. Send list messages to framers@lists.frameusers.com. To unsubscribe send a blank email to framers-unsubscr...@lists.frameusers.com or visit http://lists.frameusers.com/mailman/options/framers/archive%40mail-archive.com Send administrative questions to listad...@frameusers.com. Visit http://www.frameusers.com/ for more resources and info.
Re: Script to change a paratag based on the autonumber format
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 ___ You are currently subscribed to framers as arch...@mail-archive.com. Send list messages to framers@lists.frameusers.com. To unsubscribe send a blank email to framers-unsubscr...@lists.frameusers.com or visit http://lists.frameusers.com/mailman/options/framers/archive%40mail-archive.com Send administrative questions to listad...@frameusers.com. Visit http://www.frameusers.com/ for more resources and info.
Re: Script to change a paratag based on the autonumber format
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 ___ You are currently subscribed to framers as arch...@mail-archive.com. Send list messages to framers@lists.frameusers.com. To unsubscribe send a blank email to framers-unsubscr...@lists.frameusers.com or visit http://lists.frameusers.com/mailman/options/framers/archive%40mail-archive.com Send administrative questions to listad...@frameusers.com. Visit http://www.frameusers.com/ for more resources and info.