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 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";
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;
}
}
}
Copy link to clipboard
Copied
Just to add that none of the code snippets above work.
So I will appreciate any help.
Thanks
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;
}
}
}
Copy link to clipboard
Copied
Hello FrameExpert,
Thanks your code did the trick.
Cheers
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.
Copy link to clipboard
Copied
Cheers Please check that you see it as corrected.
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.
Copy link to clipboard
Copied
Cheers Jeff
[PII removed by moderator]