Image properties in a script/macro


I have a document with hundreds of images. I need to set the image type to the settings shown in the image.

I wrote a mcro that enumerates the image in object oGraf, what are the names of the properties marked in this dialog?

For example, the anchor is

oGraf.AnchorType =

but it is very difficult to find the other settings name (relative to, keep ratio, …)

So how can I access these properties in a macro to set them as shown?

Thank you

Many of the settings you can define in a named style (FrameStyle) and then apply to your images by assigning that style to them.
(In Basic: graphicFrameObject.FrameStyleName = newStyle)

1 Like

Agree, and not all properties.

In particular, the “keep ratio”, “auto size”, “relative to”, “width” and “height” found in the Type tab of a frame style are not applied to the object. That is the reason I was looking the properties of the graphic object.

Which is rather confusing, unless it’s a bug.

I tried to debug the extension PicTool, select the image and run the macro

Sub setImgProps 'set properties to selected image
	dim oDoc as object, oGraf as object
	oGraf=oDoc.CurrentController.getSelection 'current selection
	if oGraf.supportsService("")=TRUE then
		with oGraf
			.AnchorType=1 'Anchor As Character
			rem Keep ratio
	    	rem Width 100%
		end with
		'mri oGraf 'show the properties
	end if
End Sub
1 Like

There is also RelativeWidthRelation that defines the “relative to paragraph area”.

By the way, it’s better to test that the object supports service.