Automation Example - Text

 

This is an example for Text.

'********************************************************************************************

' text module.BAS

' This script opens an existing VOXB file and adds a text module.

' It then changes all the properties of the text.

'

'                                    -by SKP 4/2010

'

'********************************************************************************************

Sub Main

 'Declares VoxlerApp as an object

  Dim VoxlerApp As Object

 

 'Creates an instance of the Voxler application object

 'and assigns it to the variable named "VoxlerApp"

  Set VoxlerApp = CreateObject("Voxler.Application")

 

 'Make Voxler visible

  VoxlerApp.Visible = True

 

 'Access CommandApi

  Set CommandApi = VoxlerApp.CommandApi

'********************************************************************************************

' TextModule.bas

' This script opens an existing VOXB file and adds a text module.

' It then changes all the properties of the text.

'

'                                    -by SKP 4/2010

'

'********************************************************************************************

Sub Main

 

 'Declares VoxlerApp as an object

  Dim VoxlerApp As Object

 

 'Creates an instance of the Voxler application object

 'and assigns it to the variable named "VoxlerApp"

  Set VoxlerApp = CreateObject("Voxler.Application")

 

 'Make Voxler visible

  VoxlerApp.Visible = True

 

 'Access CommandApi

  Set CommandApi = VoxlerApp.CommandApi

 

 'Open an existing file

  CommandApi.Construct ("Open")

  CommandApi.Option ("Path", VoxlerApp.Path+"\Samples\Gold (ScatterPlot).voxb")

  CommandApi.DoOnce()

 

 'Add a text module

  CommandApi.Construct("CreateModule")

  CommandApi.Option ("Type", "Text")

  CommandApi.Do()

 

 'Change the text that is displayed in the text to two lines of text

  CommandApi.Construct ("ModifyModule")

  CommandApi.Option ("Module", "Text")

  CommandApi.Option ("TextText", "text in the map coordinates" + vbCrLf + "Multiple lines")

  CommandApi.Do()

 

 'Change the text X position

 'This positions the location of the text in the X map coordinates.

  CommandApi.Option ("TextXPos", "50")

  CommandApi.Do()

 

 'Change the text Y position

 'This positions the location of the text in the Y map coordinates

  CommandApi.Option ("TextYPos", "50")

  CommandApi.Do()

 

 'Change the text Z position

 'This positions the location of the text in the Z map coordinates

  CommandApi.Option ("TextZPos", "50")

  CommandApi.Do()

 

 'Change the text multiple line justification

 'This is 0, 1, or 2. 0 is left. 1 is center. 2 is right.

  CommandApi.Option ("TextJustification", "1")

  CommandApi.Do()

 

 'Change the text size

 'This is between 4 and 72

  CommandApi.Option ("TextSize", "20")

  CommandApi.Do()

 

 'Change the text color

  CommandApi.Option ("TextColor", "Plum")

  CommandApi.Do()

 

 'Change the text font to Times New Roman

  CommandApi.Option ("TextFont", "Times New Roman")

  CommandApi.Do()

 

End Sub

 

 

See Also

Automation Model

Text Module