Is the logo inside of a named unanchored frame on the reference page? You can access these frames by name. For example,
var doc = app.ActiveDoc; var refFrame = doc.GetNamedUnanchoredFrame ("Single Line"); alert (refFrame.ObjectValid ());
Tank you for your help.
with the following code :
var refFrame = doc.GetNamedUnanchoredFrame ("Logo");
the alert message send 1 seems to be "OK"
so now how to swap and copy Inside not by reference the logo (insert for framemaker) by mine.
(see zip file on adobe cloud).
You need to figure out how to import an image into your document and move it to that frame. To import an image, you use the Import method on a Doc object. To move an image, you set its FrameParent property to the target frame. I don't have time to code this for you, but this should get you started.
Your refFrame points to the frame on the reference page. The logo in the frame is a graphic object, which you can change to point to another file. Assuming the graphic is the only object in the reference frame, this will make the change for you.
var oGraphic = refFrame.FirstGraphicInFrame;
oGraphic.InsetFIle = "[reference to new logo file]" ;
Note that this does not change the image on the screen immediately. When saving and reopening the file, the change is there. Also note that the frame is not going to be resized and the new logo is supposed to have the same dimensions and DPI. If dimensions are different, you need to adapt the frame size or the graphic file DPI in your code. That is something you need to figure out using the Scripting Guide.