Highlighted

How to add UserString for a Marker object?

Community Beginner ,
Nov 28, 2018

Copy link to clipboard

Copied

Hi colleagues

I am newbie to ExtendScript So as the title says How to add UserString for a Marker object?

My code is as below, but it does not add UserString to the Markers.

var doc = app.ActiveDoc;

var flow = doc.MainFlowInDoc;

var tbl = 0;

var textItems = flow.GetText(Constants.FTI_MarkerAnchor);

var s = "Number of Comments: " + textItems.len.toString();

alert(s)

for (var i = 0; i < textItems.len; i += 1)

{

    $.write(textItems.obj.MarkerText);

    s = "Comment: " + textItems.obj.MarkerText + " @ " + textItems.obj.TextLoc.offset.toString() + "\n"
        + textItems.obj.Unique;

    GetUniqueObject(textItems.obj.Unique).UserString = "Added by Dan"; // Will add more useful data here

}

Adobe Community Professional
Correct answer by frameexpert | Adobe Community Professional

Since you already have the Marker object with textItems.obj, you should be able to add the UserString directly like this:

textItems.obj.UserString = "Added by Dan";

You don't need the GetUniqueObject method because you already have the Marker object.

Check and see if the UserString persists, though. There was a bug where setting the UserString property with ExtendScript wouldn't persist after you quit FrameMaker. It does persist with FrameScript and the FDK. They may have fixed it, but I haven't tried it yet.

TOPICS
Scripting

Views

162

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 add UserString for a Marker object?

Community Beginner ,
Nov 28, 2018

Copy link to clipboard

Copied

Hi colleagues

I am newbie to ExtendScript So as the title says How to add UserString for a Marker object?

My code is as below, but it does not add UserString to the Markers.

var doc = app.ActiveDoc;

var flow = doc.MainFlowInDoc;

var tbl = 0;

var textItems = flow.GetText(Constants.FTI_MarkerAnchor);

var s = "Number of Comments: " + textItems.len.toString();

alert(s)

for (var i = 0; i < textItems.len; i += 1)

{

    $.write(textItems.obj.MarkerText);

    s = "Comment: " + textItems.obj.MarkerText + " @ " + textItems.obj.TextLoc.offset.toString() + "\n"
        + textItems.obj.Unique;

    GetUniqueObject(textItems.obj.Unique).UserString = "Added by Dan"; // Will add more useful data here

}

Adobe Community Professional
Correct answer by frameexpert | Adobe Community Professional

Since you already have the Marker object with textItems.obj, you should be able to add the UserString directly like this:

textItems.obj.UserString = "Added by Dan";

You don't need the GetUniqueObject method because you already have the Marker object.

Check and see if the UserString persists, though. There was a bug where setting the UserString property with ExtendScript wouldn't persist after you quit FrameMaker. It does persist with FrameScript and the FDK. They may have fixed it, but I haven't tried it yet.

TOPICS
Scripting

Views

163

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
Nov 28, 2018 0
Adobe Community Professional ,
Nov 28, 2018

Copy link to clipboard

Copied

Since you already have the Marker object with textItems.obj, you should be able to add the UserString directly like this:

textItems.obj.UserString = "Added by Dan";

You don't need the GetUniqueObject method because you already have the Marker object.

Check and see if the UserString persists, though. There was a bug where setting the UserString property with ExtendScript wouldn't persist after you quit FrameMaker. It does persist with FrameScript and the FDK. They may have fixed it, but I haven't tried it yet.

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
Reply
Loading...
Nov 28, 2018 0
Community Beginner ,
Dec 01, 2018

Copy link to clipboard

Copied

I works. Many thanks.

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
Reply
Loading...
Dec 01, 2018 0
Adobe Community Professional ,
Dec 01, 2018

Copy link to clipboard

Copied

Thank you for marking my answer as correct. Did you check and see if the UserString value persists after you close the file and reopen it? I have had problems with this in the past.

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
Reply
Loading...
Dec 01, 2018 0
Community Beginner ,
Dec 02, 2018

Copy link to clipboard

Copied

Yes, it does persist, at least for the Marker objects.

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
Reply
Loading...
Dec 02, 2018 0