Highlighted

How to search for a character style (not tag) in FrameMaker with javascript?

Explorer ,
Feb 06, 2020

Copy link to clipboard

Copied

I'm trying to search for a character style in FrameMaker - not a character tag. Someone made certain text italic without properly tagging it with a character tag. Now I need to assign a tag to the text with a specific formatting. I know I can do it without a script but I do need a script solution because I need to generate a list of paragraphs which have italic text in them. This list is needed for something else. Here is what I have so far but it doesn't find the formatted text:

var doc=app.ActiveDoc
var docStart = doc.MainFlowInDoc;

var tloc = new TextLoc (docStart, 0);

// setup find parameters
findParams = AllocatePropVals(1);

findParams[0].propIdent.num = Constants.FS_FindCharFmt;
findParams[0].propVal.valType = Constants.FP_FontAngle;
findParams[0].propVal.ival = 5; //5 is int for Italic

var foundText = doc.Find(tloc, findParams);
Can someone point me in the right direction.
Thank you
Michael

TOPICS
Formatting and numbering, Scripting

Views

133

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

How to search for a character style (not tag) in FrameMaker with javascript?

Explorer ,
Feb 06, 2020

Copy link to clipboard

Copied

I'm trying to search for a character style in FrameMaker - not a character tag. Someone made certain text italic without properly tagging it with a character tag. Now I need to assign a tag to the text with a specific formatting. I know I can do it without a script but I do need a script solution because I need to generate a list of paragraphs which have italic text in them. This list is needed for something else. Here is what I have so far but it doesn't find the formatted text:

var doc=app.ActiveDoc
var docStart = doc.MainFlowInDoc;

var tloc = new TextLoc (docStart, 0);

// setup find parameters
findParams = AllocatePropVals(1);

findParams[0].propIdent.num = Constants.FS_FindCharFmt;
findParams[0].propVal.valType = Constants.FP_FontAngle;
findParams[0].propVal.ival = 5; //5 is int for Italic

var foundText = doc.Find(tloc, findParams);
Can someone point me in the right direction.
Thank you
Michael

TOPICS
Formatting and numbering, Scripting

Views

134

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
Feb 06, 2020 0

Have something to add?

Join the conversation