PreviousNext
Help > Programming with LAUNCHER Office > LNCCMD commands > Commands list > WMOVE command
WMOVE command

Moves or extends the current selection.

 

Syntax

 

CHGVAR

VAR(&CMD) VALUE('WMOVE')

CHGVAR

VAR(&PARM1) VALUE('
[From="Bookmark"];
[Direction="Direction"];
[Unit=move unit];
[Count=move units number];
[While="Lists of characters"];
[Until="Lists of characters"];
[Extend=True/False]
')

CHGVAR

VAR(&PARM2) VALUE(' ')

CALL

PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 +

&PARM2 &RESULT)

 

Parameters

 

Parameters

 

Parm1

From : Indicates the document bookmark from which selection will start.
If « From » is omitted, selection start remains unchanged.

 

Direction : Indicates the current selection move direction.
Move is made according to « Unit » property.
Possible values are :

Start : Move selection to unit start.
End : Move selection to the end.
Down : Move selection downward.
Up : Move selection upward.
Right : Move selection to right.
Left : Move selection to left.

See details part to use correctly others parameters (above) according to the Direction parameter.

 

Unit : Sets move unit.
Possible values are : wdCharacter, wdCell, wdWord, wdSentence, wdParagraph, wdSection, wdColumn, wdRow, wdTable, wdLine.

 

Count : Indicates move unit number.
This number can be positive or negative.

 

While : Selection is moved as long as a list character is present.

 

Until : Selection is moved until a list character is met.

 

Extend : Value must be « True » to extend selection, otherwise current selection is replaced.

 

 

 

 

Details

 

Direction parameter

Usable parameters

not used

 

 

 

while

Moves the specified selection while any of the specified characters are found in the document.

 

[count]  default: wdForward.

The maximum number of characters by which the specified selection is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the specified selection is moved forward in the document, beginning at the end position. If it is a negative number, the selection is moved backward, beginning at the start position.

 

Example 1.

 

until

Moves the specified selection until one of the specified characters is found in the document.

 

[count] default: wdForward.

The maximum number of characters by which the specified selection is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the selection is moved forward in the document, beginning at the end position. If it is a negative number, the selection is moved backward, beginning at the start position.

 

Example 2.

 

Collapses the specified selection to its start or end position and then moves the collapsed object by the specified number of units. This method returns a Long value that represents the number of units by which the selection was moved, or it returns 0 (zero) if the move was unsuccessful.

 

[unit] default: wdCharacter

The unit by which to move the ending character position.

[count] default: 1.

The number of units by which the specified range or selection is to be moved. If Count is a positive number, the object is collapsed to its end position and moved backward in the document by the specified number of units. If Count is a negative number, the object is collapsed to its start position and moved forward by the specified number of units.

 

Example 3.

 

start

 

while

Moves the start position of the specified selection while any of the specified characters are found in the document.

 

[count]

The maximum number of characters by which the specified range is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the range is moved forward in the document. If it is a negative number, the range is moved backward. The default value is wdForward .

 

Example 4.

 

until

Moves the start position of the specified selection until one of the specified characters is found in the document. If the movement is backward through the document, the selection is expanded.

 

[count]

The maximum number of characters by which the specified range is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the range is moved forward in the document. If it is a negative number, the range is moved backward. The default value is wdForward .

 

Example 5.

 

Moves the start position of the specified selection.

 

[unit]

The unit by which start position of the specified selection is to be moved. Can be one of the WdUnits constants. The default value is wdCharacter.

 

[count]
The maximum number of units by which the specified range is to be moved. If Count is a positive number, the start position of the range is moved forward in the document. If it is a negative number, the start position is moved backward. If the start position is moved forward to a position beyond the end position, the range is collapsed and both the start and end positions are moved together. The default value is 1.

 

Example 6

 

End

 

While

Moves the ending character position of a range while any of the specified characters are found in the document.

 

[count]

The maximum number of characters by which the range is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the range is moved forward in the document. If it is a negative number, the range is moved backward. The default value is wdForward .

 

Example 7.

 

until

Moves the end position of the specified selection until any of the specified characters are found in the document.

 

[count]

The maximum number of characters by which the specified selection is to be moved. Can be a number or either wdForwardor wdBackward. If Count is a positive number, the selection is moved forward in the document. If it is a negative number, the selection is moved backward. The default value is wdForward.

 

Example 8.

 

Moves the ending character position of a range or selection.

 

[unit]

The unit by which to move the ending character position. The default value is wdCharacter.

 

[count]

The number of units to move. If this number is positive, the ending character position is moved forward in the document. If this number is negative, the end is moved backward. If the ending position overtakes the starting position, the range collapses and both character positions move together. The default value is 1.

 

Example 9.

 

down

Moves the selection down and returns the number of units it has been moved.

[unit]

The unit by which the selection is to be moved. The default value is wdLine .

 

[count]

The number of units the selection is to be moved. The default value is 1.

 

[extend].

Can be either false or true . If false is used, the selection is collapsed to the endpoint and moved down. If true is used, the selection is extended down. The default value is false .

 

 Example 10.

 

up

Moves the selection up and returns the number of units that it has been moved.

[unit]

Can be one of the following constants: wdLine , wdParagraph , wdWindow or wdScreen . The default value is wdLine . You can use the wdWindow constant for the Unit argument to move to the top or bottom of the active window. Regardless of the value of Count (greater than 1 or less than 1), the wdWindow constant moves only one unit. Use the wdScreen constant to move more than one screen.

 

[count]

The number of units the selection is to be moved. The default value is 1.

 

[extend]

Specifies whether the selection is moved or extended. Can be either false or true . If false is used, the selection is collapsed to the endpoint and moved up. If true is used, the selection is extended up. The default value is false .

 

Example 11.

 

right

Moves the selection to the right and returns the number of units it has been moved.

[unit]

The unit by which the selection is to be moved.The default value is wdCharacter .

 

[count]

The number of units the selection is to be moved. The default value is 1.

 

[extend]

Can be either false or true . If false is used, the selection is collapsed to the endpoint and moved to the right. If true is used, the selection is extended to the right. The default value is false

 

Example 12.

 

 

left

Moves the selection to the left and returns the number of units it has been moved.

[unit]

The unit by which the selection is to be moved.The default value is wdCharacter .

 

[count]

The number of units the selection is to be moved. The default value is 1.

 

[extend]

Can be either false or true . If false is used, the selection is collapsed to the endpoint and moved to the left. If true is used, the selection is extended to the left. The default value is false .

 

Example 13.

 

 

 

Example 1:

 

a)

 

LNCCMD CMD(WMOVE) PARM1('While="Z"') : result = 0

 

b)

 

 

LNCCMD CMD(WMOVE) PARM1('While="R"'): cursor has moved by 1 character. result = 1

LNCCMD CMD(WMOVE) PARM1('While="R";count=2') : cursor has moved by 1 character. result = 1

 

 

 

c)

 

LNCCMD CMD(WMOVE) PARM1('While=" DOM";count=-5') : return =-4

 

 

Example 2:

 

a)

 

LNCCMD CMD(WMOVE) PARM1('Until="D";count=20') : result=8. cursor has moved by 8 characters

 

b)

LNCCMD CMD(WMOVE) PARM1('Until="D";count=2'): result=0

 

No characters “D” found into the range specified by count=2. The range isn't not changed and the method returns 0 (zero).

 

 

Example 3:

 

a)

 

LNCCMD CMD(WMOVE) : result=1 . One character moved

 

b)

LNCCMD CMD(WMOVE) PARM1('Unit=wdWord') : result= 1. One Word moved.

 

c)

 

LNCCMD CMD(WMOVE) PARM1('count=4')

d)

 

LNCCMD CMD(WMOVE) PARM1('count=-3')

 

Example 4:

 

a)

 

LNCCMD CMD(WMOVE) PARM1('Direction="Start";While="Z"') : result = 0

 

LNCCMD CMD(WMOVE) PARM1('Direction="Start";While="R"'): result = 0. The range starts with the M character

 

b)

 

LNCCMD CMD(WMOVE) PARM1('Direction="Start";While="MOR"'): result = 3. The start of the Range has moved by 3 characters.

 

 

Example 5:

a)

 

LNCCMD CMD(WMOVE) PARM1('Direction="Start";Until="D";count=20') : result=11. cursor has moved by 11 characters from the start of the selection.

 

b)

 

LNCCMD CMD(WMOVE) PARM1('Direction="Start";Until="D";count=2'): result=0

 

c)

 

No characters “D” found into the range specified by count=2. The range isn't not changed and the method returns 0 (zero).

 

LNCCMD CMD(WMOVE) PARM1('Direction="Start";Until="O";count=2')

 

 

Example 6:

 

a)

 

LNCCMD CMD(WMOVE) PARM1('Direction="Start"') : result=1 . One character moved.

 

b)

LNCCMD CMD(WMOVE) PARM1('Direction="Start";Unit=wdWord') : result= 1. One Word moved.

 

Example 7:

 

a)

 

LNCCMD CMD(WMOVE) PARM1('Direction="End";While="Z"') : result = 0

 

b)

LNCCMD CMD(WMOVE) PARM1('Direction="End";While="R"'): result =1. One character moved.

 

c)

 

LNCCMD CMD(WMOVE) PARM1('Direction="End";While="MOR"'): result = 1. The end of the Range has moved by a character.

 

 

 

Example 8:

 

a)

 

LNCCMD CMD(WMOVE) PARM1('Direction="End";Until="D";count=20') : result=9 cursor has moved forward by 9 characters from the end of the selection.

 

b)

LNCCMD CMD(WMOVE) PARM1('Direction="End";Until="D";count=2'): result=0

 

 

No characters “D” found into the range specified by count=2. The range isn't not changed and the method returns 0 (zero).

 

 

Example 9:

 

a)

 

LNCCMD CMD(WMOVE) PARM1('Direction="End"') : result=1 . One character moved

 

b)

LNCCMD CMD(WMOVE) PARM1('Direction="End";Unit=wdWord') : result= 1. One Word moved.

 

Example 10:

 

a)

 

LNCCMD CMD(WMOVE) PARM1('Direction="Down"') : result=1 . One line moved

 

 

 

b)

LNCCMD CMD(WMOVE) PARM1('Direction="Down";Extend=true') : result=1 . One line moved

 

Example 11:

 

 

LNCCMD CMD(WMOVE) PARM1('Direction="Up";Extend=true'): result=1 . One line moved

 

 

Example 12:

 

 

LNCCMD CMD(WMOVE) PARM1('Direction="Right";Extend=true'): result=1 . One character moved.

 

 

Example 13:

 

 

LNCCMD CMD(WMOVE) PARM1('Direction="Left";Extend=true'): result=1 . One character moved.