To insert characters using a macro, use the Text Property. Modify our tutorial file as follows:
document.selection.Text = "EmEditor supports macros.";
document.selection.Text = "\tEmEditor is a text editor.";
document.selection.Text = "EmEditor supports macros."
document.selection.Text = Chr(9) & "EmEditor is a text editor."
The following tables list commonly used escape sequences in both scripting languages.
|\xXX||The Latin-1 character with the encoding specified by the two hexadecimal digits.|
|\uXXXX||The Unicode character with the encoding specified by the four hexadecimal digits.|
|vbCrLf||Chr(13) & Chr(10)||Carriage return + new line combination.|
|vbNewLine||Chr(13) & Chr(10) or Chr(10)||Platform-specific new line character. Equivalent to vbCrLf in Windows.|
Line-endings are terminated with a combination of a \r (CR) and a \n (LF). Use the CR and LF in distinct manners. For example, if you write:
document.selection.Text = "\n";
only carriage return (LF) is inserted, which is not a line-ending convention in Windows. When you press the RETURN key in EmEditor, EmEditor inserts whatever line-ending (CR only, LF only, or CR+LF) is used in that line. If you want the same behavior upon pressing the RETURN key, as in EmEditor, we recommend that you use the NewLine Method or the writeln Method.
Send feedback on this topic to Emurasoft