Text commands
Description
These are general String-related commands that are useful when used with the other IDE Scripting commands.
Properties
Name |
Type |
Read-Only |
Shared |
---|---|---|---|
✓ |
|||
Property descriptions
Clipboard As String
Used to get or set the text contents of the OS clipboard.
Create a new Note for the selected project item and pastes in the contents of the Clipboard into the Note:
DoCommand("NewNote") Text = Clipboard
EndOfLine As String
Returns the default line ending for the OS running the IDE. This is also the line separator used for code editor text that is returned by Text and SelectedText.
This property is read-only.
Add text to a new note:
DoCommand("NewNote") Text = "Line1" + EndOfLine + "Line2"
SelectionLength As Integer
Gets or sets the length of characters in the current selection of the code editor.
SelectionStart As Integer
Gets or sets the offset of the selection (or insertion) point in the code editor.
SelectedText As String
Gets or sets the selected text in the code editor. After assign a string to SelectedText, the selection will be empty and positioned immediately after the inserted text.
Take the selected text and add an inline constant containing the text to the top of the method and replaces the selected text with the name of the constant:
Var constantText As String constantText = SelectedText Var newConstant As String newConstant = "Const kValue = """ + constantText + """" SelectionStart = SelectionStart - 1 SelectionLength = SelectionLength + 2 SelectedText = "kValue" Text = newConstant + EndOfLine + EndOfLine + Text