Msg: Difference between revisions
No edit summary |
Gordon.dye (talk | contribs) |
||
(7 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
''' | MSG("<KB>",<[[string]]>) ! send string to keyboard | ||
The '''MSG''' [[internal function]] (without the dollar sign) is only available for Windows & CS versions. This should not be confused with [[Msg$]]. | |||
For example: | |||
MSG("sleeptime",centiseconds) ! specify MSG keystroke time interval (100 = 1 Second) | MSG("sleeptime",centiseconds) ! specify MSG keystroke time interval (100 = 1 Second) | ||
With the | With the Msg internal function you can directly control the keyboard under the Windows client from within a BR program by issuing a function call to MSG. | ||
Msg is useful for redisplaying Windows menus upon returning to a menu program from an application program. MSG has no effect on Unix or Linux '''terminal''' sessions, but works under Client / Server with Unix the same as WINDOWS. | |||
The first parameter ("KB" or "kb") is case insensitive. | The first parameter ("KB" or "kb") is case insensitive. | ||
Line 49: | Line 51: | ||
{| | {| | ||
|-valign="top" | |-valign="top" | ||
|'''ALT+ ||width="75%"| press ALT - see note below | |||
| | |||
|width=" | |||
|-valign="top" | |-valign="top" | ||
| | |'''ALT- || release ALT | ||
|-valign="top"|''' | |||
|-valign="top" | |-valign="top" | ||
|'''CTRL+ || press CTRL | |||
|-valign="top" | |-valign="top" | ||
|'''CTRL- || release CTRL | |||
|-valign="top" | |-valign="top" | ||
|''' | |||
|-valign="top" | |-valign="top" | ||
|'''SHIFT+ || press SHIFT | |||
|-valign="top" | |-valign="top" | ||
|'''SHIFT- || release SHIFT | |||
|-valign="top" | |-valign="top" | ||
|''' | |||
|-valign="top" | |-valign="top" | ||
|'''TAB || press the tabulation key | |||
|-valign="top" | |-valign="top" | ||
|'''RET || press the return key | |||
|-valign="top" | |-valign="top" | ||
|'''ESC || press the escape key | |||
|-valign="top" | |-valign="top" | ||
|''' | |||
|-valign="top" | |-valign="top" | ||
|'''BACK || press the backward key | |||
|-valign="top" | |-valign="top" | ||
|'''DEL || press the delete key | |||
|-valign="top" | |-valign="top" | ||
|'''INS || press the insert key | |||
|-valign="top" | |-valign="top" | ||
|'''HELP || press the help key | |||
|-valign="top" | |-valign="top" | ||
|''' | |||
|-valign="top" | |-valign="top" | ||
|'''LEFT || send the cursor to the left (left arrow) | |||
|-valign="top" | |-valign="top" | ||
|'''RIGHT || send the cursor to the right (right arrow) | |||
|-valign="top" | |-valign="top" | ||
|'''UP || send the cursor up (up arrow) | |||
|-valign="top" | |-valign="top" | ||
|'''DOWN || send the cursor down (down arrow) | |||
|-valign="top" | |-valign="top" | ||
|''' | |||
|-valign="top" | |-valign="top" | ||
|'''PGUP || press the page up key | |||
|-valign="top" | |-valign="top" | ||
|'''PGDN || press the page down key | |||
|-valign="top" | |-valign="top" | ||
|'''HOME || press the home key | |||
|-valign="top" | |-valign="top" | ||
|'''END || press the end key | |||
|-valign="top" | |-valign="top" | ||
|''' | |||
|-valign="top" | |-valign="top" | ||
|'''F1 || press the function key F1 | |||
|-valign="top" | |-valign="top" | ||
|'''F2 || press the function key F2 | |||
|-valign="top" | |-valign="top" | ||
|'''F3 || press the function key F3 | |||
|-valign="top" | |-valign="top" | ||
|'''F4 || press the function key F4 | |||
|-valign="top" | |-valign="top" | ||
|'''F5 || press the function key F5 | |||
|-valign="top" | |-valign="top" | ||
|'''F6 || press the function key F6 | |||
|-valign="top" | |-valign="top" | ||
|'''F7 || press the function key F7 | |||
|-valign="top" | |-valign="top" | ||
|'''F8 || press the function key F8 | |||
|-valign="top" | |-valign="top" | ||
|'''F9 || press the function key F9 | |||
|-valign="top" | |-valign="top" | ||
|'''F14 || press the function key F14 | |||
|-valign="top" | |-valign="top" | ||
|'''F11 || press the function key F11 | |||
|-valign="top" | |-valign="top" | ||
|'''F12 || press the function key F12 | |||
|-valign="top" | |-valign="top" | ||
|''' | |||
|-valign="top" | |-valign="top" | ||
|'''NUM0 || press the 0 on the key pad | |||
|-valign="top" | |-valign="top" | ||
|'''NUM1 || press the 1 on the key pad | |||
|-valign="top" | |-valign="top" | ||
|'''NUM2 || press the 2 on the key pad | |||
|-valign="top" | |-valign="top" | ||
|'''NUM3 || press the 3 on the key pad | |||
|-valign="top" | |-valign="top" | ||
|'''NUM4 || press the 4 on the key pad | |||
|-valign="top" | |-valign="top" | ||
|'''NUM5 || press the 5 on the key pad | |||
|-valign="top" | |-valign="top" | ||
|'''NUM6 || press the 6 on the key pad | |||
|-valign="top" | |-valign="top" | ||
|'''NUM7 || press the 7 on the key pad | |||
|-valign="top" | |-valign="top" | ||
|'''NUM8 || press the 8 on the key pad | |||
|-valign="top" | |-valign="top" | ||
|'''NUM9 || press the 9 on the key pad | |||
|-valign="top" | |-valign="top" | ||
|''' | |||
|-valign="top" | |-valign="top" | ||
|'''NUM* || press the * on the key pad | |||
|-valign="top" | |-valign="top" | ||
|'''NUM+ || press the + on the key pad | |||
|-valign="top" | |-valign="top" | ||
|'''NUM- || press the - on the key pad | |||
|-valign="top" | |-valign="top" | ||
|'''NUM, || press the , on the key pad | |||
|-valign="top" | |-valign="top" | ||
|'''NUM/ || press the / on the key pad | |||
|-valign="top" | |-valign="top" | ||
|''' | |||
|-valign="top" | |-valign="top" | ||
|} | |} | ||
To send the pipe character specify | To send the pipe character specify <nowiki>|||</nowiki>. | ||
MSG("sleeptime",seconds) specifies the number of seconds to wait before issuing each string and each control character. Seconds may also be expressed with *up to three decimal digits* The default value is 0.2 seconds. | MSG("sleeptime",seconds) specifies the number of seconds to wait before issuing each string and each control character. Seconds may also be expressed with *up to three decimal digits* The default value is 0.2 seconds. | ||
Please note that | Please note that the ALT key needs to be depressed and released (ALT+ and ALT-) for every Alt-character specified. | ||
alt+ | |alt+|m|alt-||alt+|b|alt-| works | ||
alt+ | |alt+|mb|alt-| fails | ||
alt+ | |alt+|m|down||alt-| works | ||
This is because keyboard entries | This is because keyboard entries don't interpret more than one keystroke as an alt value except when using the numeric keypad. However Windows will honor arrow keys while the alt key is held down. | ||
<noinclude> | <noinclude> |
Latest revision as of 14:12, 21 July 2014
MSG("<KB>",<string>) ! send string to keyboard
The MSG internal function (without the dollar sign) is only available for Windows & CS versions. This should not be confused with Msg$. For example:
MSG("sleeptime",centiseconds) ! specify MSG keystroke time interval (100 = 1 Second)
With the Msg internal function you can directly control the keyboard under the Windows client from within a BR program by issuing a function call to MSG.
Msg is useful for redisplaying Windows menus upon returning to a menu program from an application program. MSG has no effect on Unix or Linux terminal sessions, but works under Client / Server with Unix the same as WINDOWS.
The first parameter ("KB" or "kb") is case insensitive.
Two new Error Codes are defined in support of this function:
- 0412 Invalid Action Code - The first parameter is not recognized.
- 0413 Window Not On Top - A KB message was sent to a task which is different from the one that currently owns the keyboard.
Note that the following error codes may be related to this function:
- 0414 Wrong number of arguments passed
- 0415 Some error that has err message
- 0416 Not enough elements in dimensioned array
- 0417 Dimensioned string length is not big enough
- 0418 Unknown
- 0419 Error in special char spec
Special Keystroke Values
This facility operates through the operating system, so it does not utilize BR scancodes. If you need to send a special character (which in turn may cause BR to generate its scancodes), you will need to emulate the corresponding keyboard activity. Special characters need to be enclosed in pipes |.
Examples
If you want to send ctrl+c, you must send the following string:
00010 MSG("KB","|CTRL+|c|CTRL-|")
This says that you want depress the "CTRL" key, type "c", and then release "CTRL".
Example:
MSG("KB","|CTRL+|p|CTRL-|")
Will input the CTRL-P character, which causes BR to perform a printscreen operation.
Special Character List
Each char must be enclosed in pipes
ALT+ | press ALT - see note below |
ALT- | release ALT |
CTRL+ | press CTRL |
CTRL- | release CTRL |
SHIFT+ | press SHIFT |
SHIFT- | release SHIFT |
TAB | press the tabulation key |
RET | press the return key |
ESC | press the escape key |
BACK | press the backward key |
DEL | press the delete key |
INS | press the insert key |
HELP | press the help key |
LEFT | send the cursor to the left (left arrow) |
RIGHT | send the cursor to the right (right arrow) |
UP | send the cursor up (up arrow) |
DOWN | send the cursor down (down arrow) |
PGUP | press the page up key |
PGDN | press the page down key |
HOME | press the home key |
END | press the end key |
F1 | press the function key F1 |
F2 | press the function key F2 |
F3 | press the function key F3 |
F4 | press the function key F4 |
F5 | press the function key F5 |
F6 | press the function key F6 |
F7 | press the function key F7 |
F8 | press the function key F8 |
F9 | press the function key F9 |
F14 | press the function key F14 |
F11 | press the function key F11 |
F12 | press the function key F12 |
NUM0 | press the 0 on the key pad |
NUM1 | press the 1 on the key pad |
NUM2 | press the 2 on the key pad |
NUM3 | press the 3 on the key pad |
NUM4 | press the 4 on the key pad |
NUM5 | press the 5 on the key pad |
NUM6 | press the 6 on the key pad |
NUM7 | press the 7 on the key pad |
NUM8 | press the 8 on the key pad |
NUM9 | press the 9 on the key pad |
NUM* | press the * on the key pad |
NUM+ | press the + on the key pad |
NUM- | press the - on the key pad |
NUM, | press the , on the key pad |
NUM/ | press the / on the key pad |
To send the pipe character specify |||.
MSG("sleeptime",seconds) specifies the number of seconds to wait before issuing each string and each control character. Seconds may also be expressed with *up to three decimal digits* The default value is 0.2 seconds.
Please note that the ALT key needs to be depressed and released (ALT+ and ALT-) for every Alt-character specified.
|alt+|m|alt-||alt+|b|alt-| works |alt+|mb|alt-| fails |alt+|m|down||alt-| works
This is because keyboard entries don't interpret more than one keystroke as an alt value except when using the numeric keypad. However Windows will honor arrow keys while the alt key is held down.