How to export chapter list from book in framemaker(Unstructured)

Community Beginner ,
Mar 08, 2022 Mar 08, 2022

Copy link to clipboard

Copied

I have a requirement to copy all the chapter list from a framemaker book to excel, as we are maintaining all chapters in a different folder also usig framemaker unstructured version, i am not getting any option copy the chapter list. can anyone help me with this.

Views

117

Likes

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

correct answers 1 Correct answer

Adobe Community Professional , Mar 09, 2022 Mar 09, 2022
Copy the code below to a text file and save it with a .jsx extension. Open your FrameMaker book, and choose File > Script > Run and select the script. It will create a text file in the same folder as the book that has a list of the file names. #target framemaker main (); function main () { var book; book = app.ActiveBook; if (book.ObjectValid () === 1) { if (book.Name !== "") { processBook (book); } else { alert ("Please save the book and run the script again.", "www.fr...

Likes

Translate

Translate
Adobe Community Professional ,
Mar 08, 2022 Mar 08, 2022

Copy link to clipboard

Copied

Hello Radha,

In cases like this I'm happy to have Snagit installed. I capture the image of anything and then it extrancts the text to the clipboard (at least 95% of the text is correct).

You may send me such an image offline and get the text within the day... (unfortunately not a thing to be done every day).

But you give me the idea to create a script for this (not ready today).

Likes

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 ,
Mar 09, 2022 Mar 09, 2022

Copy link to clipboard

Copied

Thank you so much for your kind response, I will be more happy if you provide me the script(In future), as image conversion is not 100% correct and it will not be the direct solution for this case, as of now i am converting book file to the .mif and opening with text editor and copying all the file names. Pls give me the better idea or script if you have further.

 

Thank You.

Likes

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 ,
Mar 09, 2022 Mar 09, 2022

Copy link to clipboard

Copied

Copy the code below to a text file and save it with a .jsx extension. Open your FrameMaker book, and choose File > Script > Run and select the script. It will create a text file in the same folder as the book that has a list of the file names.

 

#target framemaker

main ();

function main () {

	var book;
	
	book = app.ActiveBook;
	if (book.ObjectValid () === 1) {
		if (book.Name !== "") {
			processBook (book);
		}
		else {
			alert ("Please save the book and run the script again.",
				"www.frameexpert.com");
		}
	}
}

function processBook (book) {
	
	var file, bookComp, compFile;
	
	// Make a text file in the same folder as the book.
	// It will have the same name as the book but with a txt extension.
	file = new File (book.Name.replace (/[^\.]+$/, "txt"));
	file.open ("w");
	
	bookComp = book.FirstComponentInBook;
	while (bookComp.ObjectValid () === 1) {
		compFile = new File (bookComp.Name);
		file.writeln (File.decode (compFile.name));
		bookComp = bookComp.NextBookComponentInDFSOrder;
	}
	
	file.close ();
}

Likes

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 ,
Mar 09, 2022 Mar 09, 2022

Copy link to clipboard

Copied

Woww... Its working absolutely thank you so much, it made my work so easy.

Likes

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 ,
Mar 10, 2022 Mar 10, 2022

Copy link to clipboard

Copied

Rick, why do you write

compFile = new File (bookComp.Name);
file.writeln (File.decode (compFile.name));

and not just

file.writeln (bookComp.Name);

? In my case this provides, for example (which is the same when using Your approach):

E:\_DDDprojects\FM-JsxLib\Docu\FMjsxLib_titlepages.fm
E:\_DDDprojects\FM-JsxLib\Docu\FMjsxLibTOC.fm
...

 

Likes

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 ,
Mar 10, 2022 Mar 10, 2022

Copy link to clipboard

Copied

I wasn't sure if he wanted the paths so I made a File object so I could just write the base file name. The File.decode method prevents spaces from being converted to %20, etc.

Likes

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 ,
Mar 11, 2022 Mar 11, 2022

Copy link to clipboard

Copied

Interesting!

However, I have no problems with strange file names:

...\with blanks.fm
...\Ordinary.fm
...\Uni→Code.fm
...\GrünLöff.fm

 Could it be that the situation has been change on the way to FM-15 and Your method was required in previous versions of FM?

Likes

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 ,
Mar 11, 2022 Mar 11, 2022

Copy link to clipboard

Copied

LATEST

Did you make a File object? When you make a File object it seems to encode non-ASCII characters.

Of course, I could have used this instead of a File object:

// Remove all characters up to and including the last backslash.
file.writeln (bookComp.Name.replace (/^.+\\/, ""));

Likes

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