Skip to main content
roym76266846
Known Participant
November 14, 2024
Answered

Removing/Changing the border surrounding a grophic object in FrameMaker

  • November 14, 2024
  • 1 reply
  • 656 views

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 object
// 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";

 

 

    This topic has been closed for replies.
    Correct answer frameexpert

    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;
            }
        }
    }

    1 reply

    roym76266846
    Known Participant
    November 14, 2024

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

    So I will appreciate any help.

    Thanks

     

    frameexpert
    Community Expert
    frameexpertCommunity ExpertCorrect answer
    Community Expert
    November 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;
            }
        }
    }
    roym76266846
    Known Participant
    November 19, 2024

    Hello FrameExpert,

    Thanks your code did the trick.

    Cheers