Enclose selection in specified tags

Build 1501 on 14/Nov/2017  This topic last edited on: 17/May/2013, at 10:25

This script encloses selection in the specified tags.

Function EncloseInTags(tag1, tag2)

if Text.TestTextSelection then

  dim objStart = Text.GetCursor(modeSrcOn,cposSelBegin,False)

  dim objEnd = Text.GetCursor(modeSrcOn,cposSelEnd,False)

  Ted.CursorTo objend

  ted.inscmd tag2

  Ted.CursorTo objStart

  ted.inscmd tag1

end if

end function

 

Example:

EncloseInTags "bd 1", "bd 0"