Quantcast
Channel: Adobe Community : All Content - FrameMaker Scripting
Viewing all articles
Browse latest Browse all 888

wrap text with element

$
0
0

Hello,

 

I'm using FM12 with structured docs. I'm looking to convert some Framescript into Extendscript language.

I finish my first Extendscript this morning (too me 3 days) : searching Element and saving the attributes value into a text file.

But I'm stuck converting my second one.

 

In a structured doc, i want to wrap a selected text with a element "PRESS" into a element "PARA" (the element PRESS is allowed in the element PARA by the DTD/EDD).

 

My Framescript (FS 6.0)

Set vCurrentDoc = ActiveDoc;

Set vSelect = vCurrentDoc.TextSelection;

// Get the Element Def

Get Object NewVar(vEltDef) Type(ElementDef) Name('PRESS');

// Wrap the selected text

Wrap ElementDef(vEltDef);

// Select the new PRESS element

Set vPRESS = ElementSelection.begin.child;

// Create the attribs

New AttributeList NewVar(vPRESSatt) AttrName('SMALLCAPS') Value('1');

// Assign the Attributes to the tag

Set vPRESS.Attributes = vPRESSatt;

In Extendscript, how do i write it?

 

var vCurrentDoc = app.ActiveDoc;

var vSelect = vCurrentDoc.TextSelection;

var vElem = vCurrentDoc.GetNamedElementDef("PRESS");

var attrs = vElem.AttributeDefs;

attrs[1].values = "ITAL";

vElem.Attributes = attrs;

vElem.WrapElement();

The script add the PRESS element but the attribute is not fill. Why? and how to correct it?

 

Many thanks for considering my request.

 

Ce message a été modifié par : Philippe Pinpin Add info


Viewing all articles
Browse latest Browse all 888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>