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

Removing/Changing the border surrounding a grophic object in FrameMaker

New Here ,
Nov 14, 2024 Nov 14, 2024

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

 

 

757
Translate
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;
        }
    }
}
Translate
New Here ,
Nov 14, 2024 Nov 14, 2024

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

So I will appreciate any help.

Thanks

 

Translate
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

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

Hello FrameExpert,

Thanks your code did the trick.

Cheers

Translate
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

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.

Translate
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

Cheers Please check that you see it as corrected.

Translate
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

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.

Translate
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
LATEST

Cheers Jeff
[PII removed by moderator]

Translate
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