Using ExtendScript, how to get the list of all headings including numberings, text and their locations?

Community Beginner ,
Nov 28, 2018 Nov 28, 2018

Copy link to clipboard

Copied

Hi

I have a book, now I need to create a report  of all headings including numberings, text and their locations. It should look like a TOC but in an external text file.

How to achieve that?

Thanks

TOPICS
Scripting

Views

607

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 28, 2018 Nov 28, 2018

Copy link to clipboard

Copied

You don't need an ExtendScript for that. You can just copy and paste the TOC into a text file. Or save it directly from FM to a text file. It won't looks as pretty, but it'll all be there.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 28, 2018 Nov 28, 2018

Copy link to clipboard

Copied

No, I still need to do it programatically, because more calculations based on heading numbers and locations are needed.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 28, 2018 Nov 28, 2018

Copy link to clipboard

Copied

What do you mean by locations?

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 28, 2018 Nov 28, 2018

Copy link to clipboard

Copied

I mean like TextLoc property.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 01, 2018 Dec 01, 2018

Copy link to clipboard

Copied

Can anyone help? I need this urgently.

Thanks in advance.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Dec 01, 2018 Dec 01, 2018

Copy link to clipboard

Copied

I will be glad to help if you have budget for this. I can't do it for free, but if you give me clear specs on what you need, I am sure I can give you a well-commented script that will meet your requirements. Feel free to contact me offlist: rick at frameexpert dot com

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 02, 2018 Dec 02, 2018

Copy link to clipboard

Copied

Sorry, I don't have budget for this

Anyway, I'll try to parse all the paragraphs and get Chapter/Section/Subsection NumberText.

Thanks.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 02, 2018 Dec 02, 2018

Copy link to clipboard

Copied

I am pretty sure you can create a list of paragraphs that contains all the information you need. This means you would not need to do any scripting at all. The List of Paragraphs

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Dec 14, 2018 Dec 14, 2018

Copy link to clipboard

Copied

Like 4everJang​ and Lin Sims​ wrote: You could use FrameMaker’s build-in “List of Paragraphs” feature for this, which will create a TOC-like, separate file listing all pgfs with all information you want to have (numbering, content, location). You can also trigger the creation of this document programatically.

But I have the slight hunch (based on you mentioning TextLoc) that you might be on the wrong path. Can you explain in more detail, what you want to achieve?

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 14, 2018 Dec 14, 2018

Copy link to clipboard

Copied

What I need to do is as below:

1. Scan all the Markers of type Comments

2. If on has a specify content in the form #24537 (any five digit number after a #) then

3a. Report the section header number of which it resides, and its page number

3b. Generate a number based on its relative order in that section. For instance under section "1.3.2 Methodology" there are 3 Comments, then each should be assigned a number 1, 2 and 3 ccordingly, based on their order in the document.

Many thanks for your help.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Dec 14, 2018 Dec 14, 2018

Copy link to clipboard

Copied

Now we are getting somewhere. Here are the questions you need to ask:

1) How do I get the list of Comment markers in document order?

2) For a given Comment marker, how do I find its parent section paragraph.

3) For a given paragraph, how do I find its page and page number?

Too bad you don't have budget for this. I could make a script that would give you exactly what you need. However, if you ask these questions on separate threads, you should be able to put the pieces together.

-Rick

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 17, 2018 Dec 17, 2018

Copy link to clipboard

Copied

I guess not having a budget for this really means your manager is being penny-wise and pound-foolish. Only a small number of people can afford to become experts in scripting for FrameMaker, as most of the knowledge is not the scripting language but the huge object model of FrameMaker. That is where years of experience pays off. Except for simple stuff, such as aligning graphics in their frames or compiling a non-ordered list of certain elements, it is simply a lot of work to get to know all the details and avoid all the pitfalls. FrameMaker is an extremely powerful product and has tons of options that often interoperate in sometimes unexpected ways.

The time it would take you to get this type of script working in all possible usage scenarios is probably worth much more than the small budget required to have Rick do the scripting for you. I have contracted him in the past and he is quick and inexpensive, and his scripting is of high quality. So unless your job is to become a scripting expert, you should really talk some sense into your manager and get the required budget to get the scripting done for you. It is usually not a mater of not having a budget, but more a matter of where you want to spend your money.

Good luck, whatever road you will end up choosing

4everJang

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Dec 17, 2018 Dec 17, 2018

Copy link to clipboard

Copied

We all started at some point in time somewhere at zero and made our way to become the experts we are today – with a lot of self-learning and usually also with the support of the community 😉

And we still don’t stop leaning, don’t we?

Just saying … 😉

That said: No one should expect to get ready-to-implement business solutions from other hard working experts (who make their living by creating business solutions) for free.

One of my favorite quotes is from Isaac Newton: "If I have seen further it is by standing on the shoulders of Giants."

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 17, 2018 Dec 17, 2018

Copy link to clipboard

Copied

I completely agree with you Stefan. Most of the questions about scripting are simple enough to answer. But sometimes what is requested is not at all a simple job. Those are the ones where some companies should really decide where they want to spend their budgets. Too often the hours of their own work force are not taken into account when looking for solutions. That makes selling your skils to customers much harder to do than it really should.

BTW, I have been wanting to start a series on learnig ExtendScript for FrameMaker. Maybe after I have settled in Belgium I will find the time to write one blog per month - or even more often. Interested ?

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Dec 17, 2018 Dec 17, 2018

Copy link to clipboard

Copied

Nothing to add on the first part 🙂

And regarding the ExtendScript blog post series: Yeah! Definitively! I will be happy to publish them on Adobe TechComm Blog – The place to talk about Technical Communication!

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Dec 17, 2018 Dec 17, 2018

Copy link to clipboard

Copied

Thanks for the love brother Jang! I feel the same about your work: top-quality and very innovative.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines