Skip to main content
4everJang
Legend
January 19, 2015
Answered

Setting property ssval

  • January 19, 2015
  • 2 replies
  • 1241 views

Hello fellow scripters,

I am trying to get a script include a TOC in a generated book. I can add the new BookComponent (copied from a template file) as a TOC, set it to generatable and include it in the update process, but all I get is an empty TOC, as the ExtractTags property of the new BookComponent is not set. I tried to set this property by passing it a string array but that action is completely ignored. Then I got the propVals array and tried to set the property there, then pass back the propVals. That is where FM12 hangs up and I have to restart it to become responsive again.

This is the piece of code I am using:

oaProps = oComp.GetProps ( );
i = GetPropIndex ( oaProps, Constants.FP_ExtractTags );
oaProps.propVal.ssval.push ( "Title_0" );
oaProps.propVal.ssval.push ( "Title_1" );
oaProps.propVal.ssval.push ( "Title_2" );
oComp.SetProps ( oaProps );

Maybe I am doing something illegal here but the local copy of my properties does show the strings as I push them into the ssval array. There must be a specific way to set these strings array propVals but there is no documentation about it. Does anyone have experience with this ?

Thanks

Jang

This topic has been closed for replies.
Correct answer frameexpert

Hi Jang, Did you try setting the ExtractTags property directly without using a property list? This works for me with the TOC component selected:

#target framemaker

var book = app.ActiveBook;

var bookComp = book.FirstSelectedComponentInBook;

var extractTags = bookComp.ExtractTags;

extractTags.push ("Heading1");

bookComp.ExtractTags = extractTags;

2 replies

Participating Frequently
July 22, 2019

Strings is sadly not an Array, and does not inherit any of Array's properties.

An instance of Strings will inherit concat, push, pop and toString from the Strings object though.

An instance also has a length property and enumerated properties (0, 1, 2, etc.) to hold each string.

An instance can be constructed with

new Strings()

passing in either 0 or more string arguments, or a single Array of strings.

The same is also true of Ints, UInts, PropVals, TypedVals, etc.

frameexpert
Community Expert
Community Expert
January 19, 2015

Hi Jang, Are the paragraph formats you are including in your ExtractTags array in the book's first component? I have found that you sometimes have to make sure they are in the first component and update the book before the ExtractTags property of the TOC will work. I am not sure why this is, but I think it mimics what happens in the interface. When you add a TOC component "by hand" and set up the Include formats, it will only show the formats that are in the first component in the book. -Rick

www.frameexpert.com
4everJang
4everJangAuthor
Legend
January 19, 2015

Hi Rick,

Yes, the formats are available. As I mentioned, Frame hangs when I try to run SetProps after adding anything to the ssval strings array in that one property. I have now tried to do something that should definitely work, but it gives the same result.

oaProps = oComp.GetProps ( );

oComp.SetProps ( oaProps );

It hangs on the last line. Obviously, this is not as it is suppoed to be. I will file a bug report and see what the Adobe guys can tell me.

Ciao

Jang

frameexpert
Community Expert
frameexpertCommunity ExpertCorrect answer
Community Expert
January 19, 2015

Hi Jang, Did you try setting the ExtractTags property directly without using a property list? This works for me with the TOC component selected:

#target framemaker

var book = app.ActiveBook;

var bookComp = book.FirstSelectedComponentInBook;

var extractTags = bookComp.ExtractTags;

extractTags.push ("Heading1");

bookComp.ExtractTags = extractTags;

www.frameexpert.com