• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Removing/Changing the border surrounding a grophic object in FrameMaker

New Here ,
Nov 14, 2024 Nov 14, 2024

Copy link to clipboard

Copied

Hello,

In our FrameMaker documents, we have placed graphic objects whose edges (borders) we have colored Blue. The blue surrounding border was added using the Object Properties dialog box (see attachment). My goal is to loop through all the graphics and remove this border. I have attached an example of a graphic with a blue border and a screenshot of the Object Dialog box. I have tried a few variations of code myself:

Looping through with a For loop:

for (var i = 0; i < doc.graphics.length; i++) {
var graphic = doc.graphics[i];
// Get each graphic objectgraphicImage1.gif
// Check if the graphic is an image object (FrameMaker considers images as 'graphic' objects)
if (graphic instanceof Graphic) {
var graphicObjProps = graphic.objectProps;
// Access the graphic's properties
// Clear the border color (if any)
graphicObjProps.strokeColor = null;
// Remove any stroke/border color
graphicObjProps.strokeWidth = 0;
// Optionally, you can set the stroke width to 0
}
}

Directly, changing the object thus..:

countDefined = 0;
var F1 = new File(doc.Name);

$.write("ListGraphics: doc.Name ="+doc.Name+'\n');
$.write("ListGraphics: Parent Folder of doc.Name ="+F1.parent.fsName+'\n');

var graphic = doc.FirstGraphicInDoc;
while(graphic) {
var graphicObjProps = graphic.ObjProps;
graphicObjProps.strokeColor = null;
graphicObjProps.strokeWidth = 0;

 

and 

function ListGraphics(doc)
{
count = 0;
countDefined = 0;
var F1 = new File(doc.Name);
$.write("ListGraphics doc.Name ="+doc.Name+'\n');
$.write("ListGraphics Parent Folder of doc.Name ="+F1.parent.fsName+'\n');
var graphic = doc.FirstGraphicInDoc;
while(graphic) {
graphic.BorderWidth=0;
graphic.BorderColor="White";

 

 

Views

168

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

Community Expert , Nov 14, 2024 Nov 14, 2024

Start with this. Select one imported graphic and run the code and see if it removes the blur border. You may have to process Control+L to refresh the screen after you run it.

var doc, graphic;

doc = app.ActiveDoc;
if (doc.ObjectValid () === 1) {
    graphic = doc.FirstSelectedGraphicInDoc;
    if (graphic.ObjectValid () === 1) {
        if (graphic.constructor.name === "Inset") {
            graphic.BorderWidth = 0;
            graphic.Pen = Constants.FV_FILL_CLEAR;
        }
    }
}

Votes

Translate

Translate
New Here ,
Nov 14, 2024 Nov 14, 2024

Copy link to clipboard

Copied

Just to add that none of the code snippets above work. 

So I will appreciate any help.

Thanks

 

Votes

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 Expert ,
Nov 14, 2024 Nov 14, 2024

Copy link to clipboard

Copied

Start with this. Select one imported graphic and run the code and see if it removes the blur border. You may have to process Control+L to refresh the screen after you run it.

var doc, graphic;

doc = app.ActiveDoc;
if (doc.ObjectValid () === 1) {
    graphic = doc.FirstSelectedGraphicInDoc;
    if (graphic.ObjectValid () === 1) {
        if (graphic.constructor.name === "Inset") {
            graphic.BorderWidth = 0;
            graphic.Pen = Constants.FV_FILL_CLEAR;
        }
    }
}

Votes

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
New Here ,
Nov 19, 2024 Nov 19, 2024

Copy link to clipboard

Copied

Hello FrameExpert,

Thanks your code did the trick.

Cheers

Votes

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 Expert ,
Nov 19, 2024 Nov 19, 2024

Copy link to clipboard

Copied

Did you figure how to process all of the graphics in the document? If you are all set, please mark my answer as the Correct Answer. Thank you.

Votes

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
New Here ,
Nov 19, 2024 Nov 19, 2024

Copy link to clipboard

Copied

Cheers Please check that you see it as corrected.

Votes

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 Expert ,
Nov 19, 2024 Nov 19, 2024

Copy link to clipboard

Copied

lol - you were close @roym76266846 - it's Rick's answer that gets marked as the correct one so that anybody coming across this discussion will learn something.

Votes

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
New Here ,
Nov 19, 2024 Nov 19, 2024

Copy link to clipboard

Copied

LATEST

Cheers Jeff
[PII removed by moderator]

Votes

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