CHANGE ANNOTATION TEXT OBJECT BASED ON TEXT STRING VALUE . . .
2020-08-21-183542
All --
I have a large set of IMAGE-PRO TIF IMAGE FILES.
There are ANNOTATION OBJECTS present in / on the TIF IMAGES.
The CODE below will allow me to change the TEXT in the ANNOTATION TEXT OBJECT from what it was to "FRED".
If I want to append "FRED" to the old TEXT in the ANNOTATION TEXT OBJECT or I want to change the TEXT to "FRED" only if it is "WILMA", how do I get the value for the TEXT within an ANNOTATION TEXT OBJECT.
For this set of images, I believe that there will be only one ANNOTATION TEXT OBJECT on the IMAGE but if there is a way to query the image for the number of ANNOTATION TEXT OBJECTS and loop through them so that all of the TEXT STRINGS are examined and updated, that would be super.
Thanks in advance.
-- Matt
Public Function NewMacro() As SimpleScript NewMacro = New SimpleScript Dim image1, doc1 With Application.DocumentCommands.ActiveImage(NewMacro) .Run(image1) End With With [Select].AnnotationsCommands.SelectObject(NewMacro) .Overlay = Overlays.OverlayType.AnnotationsOverlay .GraphicObject = 6 .Selected = False .Run(image1) End With With [Select].AnnotationsCommands.SelectObject(NewMacro) .Overlay = Overlays.OverlayType.AnnotationsOverlay .GraphicObject = 1 .Selected = True .Run(image1) End With With Application.Gadgets.DisplayOptions(NewMacro) .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Checked .Run() End With With Application.DocumentCommands.Define(NewMacro) .Run(image1, doc1) End With With [Select].Annotations.ShapeCommands.Text(NewMacro) .Overlay = Overlays.OverlayType.AnnotationsOverlay .ApplyTo = Overlays.ShapeAction.SelectedGraphicObject .Text = "FRED" .Run(doc1) End With With [Select].AnnotationsCommands.SelectObject(NewMacro) .Overlay = Overlays.OverlayType.AnnotationsOverlay .GraphicObject = 1 .Selected = False .Run(image1) End With End Function
0
Answers
As Craig mentioned, you should use low level overlay functions. Here is a sample macro that can be used as a starter. Note that your project must have a reference to MediaCy.IQL.Display and "Imports MediaCy.IQL.Display.Overlays"
Yuri