Sample scripts

Build 1501 on 14/Nov/2017  This topic last edited on: 23/Mar/2016, at 12:22

Example 1 - script to decrease the point size of the selected characters by 1 point:

If Text.EditBlockNoCmd = 0 Then

  Dim objTS = Text.GetTextStatus

  If Not objTS.HasCharH Or Not objTS.HasCharW Then

    MsgBox ("Different point sizes in the selected text")

  Else

    objTS.CharH = objTS.CharH - 1000

    objTS.CharW = objTS.CharW - 1000

    Text.SetTextStatus (objTS)

  End If

End If

Example 2 - script to reset all the attributes of the selected characters to the ones set by the paragraph style (equivalent to the command TxtStyle <Para> in the old 16 bit Ted and Fred):

Dim objTS = Text.GetParaTextStatus

Text.SetTextStatus objTS

Example 3 - display the text underlines at the cursor position (or of the selected text):

dim str as String = ""

Dim objTS = Text.GetTextStatus

If Not objTS.HasUnderlines Then

  str = "Undelines not defined"

Else

  If objTS.NUnderlines = 0 Then

    str = "No underline(s)"

  Else

    str = ""

    For i = 0 To objTS.NUnderlines-1

     str = str & " Y=" & objTS.UY(i)

     str = str & " H=" & objTS.UH(i)

     str = str & " Color=" & objTS.UColor(i)

     str = str & " Gray=" & objTS.UGray(i)

     str = str & " Flags=" & objTS.UFlags(i)

     str = str & chr(13) & chr(10)

    Next

  End If

End If

  MsgBox (str)

Example 4 - clears all the underlines for the selected text:

Dim objTS = Text.GetTextStatus

objTS.UReset

Text.SetTextStatus(objTS)