Copy link to clipboard
Copied
How do I select all text frames in framemaker using extendscript ?
Copy link to clipboard
Copied
What is the overall thing you are trying to accomplish?
Copy link to clipboard
Copied
Hi ,
I need to add and remove textframe in framemaker when page zoom and fit in page window process,and i want to move the textframe in page of the bottom in framemaker using extendscript.So please suggests if any ideas.
Copy link to clipboard
Copied
With ExtendScript, you don't really have to select a text frame to move it like you do in the interface. If you get the TextFrame object in a variable, you can change its LocX, LocY, Width, and Height properties to move it and resize it.
Copy link to clipboard
Copied
Here is how you can add a text frame to the current page:
#target framemaker
// Get the active document object.
var doc = app.ActiveDoc;
// Define variables.
var page, textFrame;
// Get the current page.
page = doc.CurrentPage;
// Add a text frame to the page.
textFrame = doc.NewTextFrame (page.PageFrame);
// "Mark" the text frame so you can find it later.
textFrame.Flow.Name = "zoom_frame";
// Use the LocX, LocY, Width, and Height properties
// to position and resize the text frame.
// ...
Copy link to clipboard
Copied
Here is how you can find the text frame you added earlier and delete it:
#target framemaker
var doc = app.ActiveDoc;
var page, textFrame;
// Set a variable for the current page.
page = doc.CurrentPage;
// Try to find the text frame with the "zoom_frame" text flow.
textFrame = getTextFrame (page, "zoom_frame");
// If the text frame is found, delete it.
if (textFrame) {
textFrame.Delete ();
}
function getTextFrame (page, flow) {
// This function will find a text frame that
// has a specified flow name on the page.
var graphic;
graphic = page.PageFrame.FirstGraphicInFrame;
while (graphic.ObjectValid () === 1) {
if (graphic.constructor.name === "TextFrame") {
if (graphic.Flow.Name === flow) {
return graphic;
}
}
graphic = graphic.NextGraphicInFrame;
}
}