'******************************************************************************************** ' AnnotationModule.bas ' This script creates a new VOXB file and adds an annotation. ' It then changes all the properties of the annotation. ' ' -by SKP 4/2010 ' '******************************************************************************************** ' If Voxler is running, retrieve the current instance of Voxler. Otherwise, ' create a new instance of Voxler. Function VoxlerApplication() On Error Resume Next Set VoxlerApplication = GetObject(, "Voxler.Application") If Err.Number <> 0 Then Set VoxlerApplication = CreateObject("Voxler.Application") End If On Error GoTo 0 End Function Sub Main 'Retrieve running instance of Voxler or create a new instance of Voxler Dim VoxlerApp As Object Set VoxlerApp = VoxlerApplication() 'Make Voxler visible VoxlerApp.Visible = True 'Access CommandApi Set CommandApi = VoxlerApp.CommandApi 'Create a new Voxler document CommandApi.Construct ("New") CommandApi.DoOnce() 'Add an annotation CommandApi.Construct("CreateModule") CommandApi.Option ("Type", "Annotation") CommandApi.Do() 'Change the text that is displayed in the annotation to two lines of text CommandApi.Construct ("ModifyModule") CommandApi.Option ("Module", "Annotation") CommandApi.Option ("AnnotationText", "New Voxler Annotation Automation" + vbCrLf + "Multiple lines") CommandApi.Do() 'Change the annotation origin location 'This is 0, 1, 2, or 3 for Upper Left, Upper Right, Lower Left, or Lower Right CommandApi.Option ("AnnotationOrigin", "2") CommandApi.Do() 'Change the annotation X position 'This positions the horizontal location of the annotation relative to the AnnotationOrigin. 'This is between 0 and 1. 0 puts it at the origin. 1 at the far side. CommandApi.Option ("AnnotationXPos", "0.25") CommandApi.Do() 'Change the annotation Y position 'This positions the vertical location of the annotation relative to the AnnotationOrigin 'This is between 0 and 1. 0 puts it at the origin. 1 at the far side. CommandApi.Option ("AnnotationYPos", "0.5") CommandApi.Do() 'Change the annotation multiple line justification 'This is 0, 1, or 2. 0 is left. 1 is center. 2 is right. CommandApi.Option ("AnnotationJustification", "1") CommandApi.Do() 'Change the annotation text size 'This is between 4 and 72 CommandApi.Option ("AnnotationSize", "20") CommandApi.Do() 'Change the annotation text color CommandApi.Option ("AnnotationColor", "Plum") CommandApi.Do() 'Change the annotation text font to Times New Roman CommandApi.Option ("AnnotationFont", "Times New Roman") CommandApi.Do() 'Turn on or off antialiasing on the annotation text CommandApi.Option ("AnnotationAntialias", "False") CommandApi.Do() End Sub