Move Cursor (Tutorial)¶
To move the cursor, add the fourth line to our tutorial macro as follows: Save the macro and run it in a new EmEditor window. Notice that the cursor is positioned
at 12 characters left from the end of the line, or at the position where the first 't' character of "text editor" is.
CharLeft Method moves
the cursor the specified number of characters to the left.
The first argument (false) of theCharLeft Method specifies whether the selection range is to be changed. That is,
it specifies whether you want to use the SHIFT key when you
use the LEFT ARROW key on your keyboard.
The following methods are provided to manipulate cursor movements. Move the cursor the specified number of characters to the left. Equivalent to the LEFT ARROW key. Move the cursor the specified number of characters to the right. Equivalent to the RIGHT ARROW key. Move the cursor the specified number of lines down. Equivalent to the DOWN ARROW key. Move the cursor the specified number of lines up. Equivalent to the UP ARROW key. Move the cursor one word to the left. Equivalent to CTRL + LEFT ARROW. Move the cursor one word to the right. Equivalent to CTRL + RIGHT ARROW. Move the cursor down one tab. Equivalent to the PAGE DOWN key. Move the cursor up one page. Equivalent to the PAGE UP key. Move the cursor to the beginning of the line. Equivalent to the HOME key. Move the cursor to the end of the line. Equivalent to the END key. Move the cursor to the start of a document. Equivalent to CTRL+ HOME. Move the cursor to the end of a document. Equivalent to CTRL+ END. Move the cursor to the matching brace. The following method moves the cursor to the specified line or digit position. Set the cursor position.¶
[JavaScript]¶
document.selection.Text = "EmEditor supports macros.";
document.selection.NewLine();
document.selection.Text = "\tEmEditor is a text editor.";
document.selection.CharLeft( false, 12 );
[VBScript]¶
document.selection.Text = "EmEditor supports macros."
document.selection.NewLine
document.selection.Text = Chr(9) & "EmEditor is a text editor."
document.selection.CharLeft False, 12