Msg: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
No edit summary
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
'''The MSG internal function (without the dollar sign) is only available for Windows & CS versions.'''
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)
MSG("KB",string$) ! send string to keyboard


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:
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.


Notice there is no dollar sign on this function name. This is useful for redisplaying Windows menus upon returning to a menu program from an application program. MSG has no affect on Unix or Linux *terminal* sessions, but works under Client / Server with Unix the same as WINDOWS.
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"
|width="10%"|'''ALT+ press ALT - see note below
|'''ALT+ ||width="75%"| press ALT - see note below
|-valign="top"
|width="10%"|'''ALT- release ALT
|-valign="top"
|-valign="top"
|width="10%"|'''
|'''ALT- || release ALT
|-valign="top"|'''
|-valign="top"
|-valign="top"
|width="10%"|'''CTRL+ press CTRL
|'''CTRL+ || press CTRL
|-valign="top"
|-valign="top"
|width="10%"|'''CTRL- release CTRL
|'''CTRL- || release CTRL
|-valign="top"
|-valign="top"
|width="10%"|'''
|'''
|-valign="top"
|-valign="top"
|width="10%"|'''SHIFT+ press SHIFT
|'''SHIFT+ || press SHIFT
|-valign="top"
|-valign="top"
|width="10%"|'''SHIFT- release SHIFT
|'''SHIFT- || release SHIFT
|-valign="top"
|-valign="top"
|width="10%"|'''
|'''
|-valign="top"
|-valign="top"
|width="10%"|'''TAB press the tabulation key
|'''TAB || press the tabulation key
|-valign="top"
|-valign="top"
|width="10%"|'''RET press the return key
|'''RET || press the return key
|-valign="top"
|-valign="top"
|width="10%"|'''ESC press the escape key
|'''ESC || press the escape key
|-valign="top"
|-valign="top"
|width="10%"|'''
|'''
|-valign="top"
|-valign="top"
|width="10%"|'''BACK press the backward key
|'''BACK || press the backward key
|-valign="top"
|-valign="top"
|width="10%"|'''DEL press the delete key
|'''DEL || press the delete key
|-valign="top"
|-valign="top"
|width="10%"|'''INS press the insert key
|'''INS || press the insert key
|-valign="top"
|-valign="top"
|width="10%"|'''HELP press the help key
|'''HELP || press the help key
|-valign="top"
|-valign="top"
|width="10%"|'''
|'''
|-valign="top"
|-valign="top"
|width="10%"|'''LEFT send the cursor to the left (left arrow)
|'''LEFT || send the cursor to the left (left arrow)
|-valign="top"
|-valign="top"
|width="10%"|'''RIGHT send the cursor to the right (right arrow)
|'''RIGHT || send the cursor to the right (right arrow)
|-valign="top"
|-valign="top"
|width="10%"|'''UP send the cursor up (up arrow)
|'''UP || send the cursor up (up arrow)
|-valign="top"
|-valign="top"
|width="10%"|'''DOWN send the cursor down (down arrow)
|'''DOWN || send the cursor down (down arrow)
|-valign="top"
|-valign="top"
|width="10%"|'''
|'''
|-valign="top"
|-valign="top"
|width="10%"|'''PGUP press the page up key
|'''PGUP || press the page up key
|-valign="top"
|-valign="top"
|width="10%"|'''PGDN press the page down key
|'''PGDN || press the page down key
|-valign="top"
|-valign="top"
|width="10%"|'''HOME press the home key
|'''HOME || press the home key
|-valign="top"
|-valign="top"
|width="10%"|'''END press the end key
|'''END || press the end key
|-valign="top"
|-valign="top"
|width="10%"|'''
|'''
|-valign="top"
|-valign="top"
|width="10%"|'''F1 press the function key F1
|'''F1 || press the function key F1
|-valign="top"
|-valign="top"
|width="10%"|'''F2 press the function key F2
|'''F2 || press the function key F2
|-valign="top"
|-valign="top"
|width="10%"|'''F3 press the function key F3
|'''F3 || press the function key F3
|-valign="top"
|-valign="top"
|width="10%"|'''F4 press the function key F4
|'''F4 || press the function key F4
|-valign="top"
|-valign="top"
|width="10%"|'''F5 press the function key F5
|'''F5 || press the function key F5
|-valign="top"
|-valign="top"
|width="10%"|'''F6 press the function key F6
|'''F6 || press the function key F6
|-valign="top"
|-valign="top"
|width="10%"|'''F7 press the function key F7
|'''F7 || press the function key F7
|-valign="top"
|-valign="top"
|width="10%"|'''F8 press the function key F8
|'''F8 || press the function key F8
|-valign="top"
|-valign="top"
|width="10%"|'''F9 press the function key F9
|'''F9 || press the function key F9
|-valign="top"
|-valign="top"
|width="10%"|'''F10 press the function key F10
|'''F14 || press the function key F14
|-valign="top"
|-valign="top"
|width="10%"|'''F11 press the function key F11
|'''F11 || press the function key F11
|-valign="top"
|-valign="top"
|width="10%"|'''F12 press the function key F12
|'''F12 || press the function key F12
|-valign="top"
|-valign="top"
|width="10%"|'''
|'''
|-valign="top"
|-valign="top"
|width="10%"|'''NUM0 press the 0 on the key pad
|'''NUM0 || press the 0 on the key pad
|-valign="top"
|-valign="top"
|width="10%"|'''NUM1 press the 1 on the key pad
|'''NUM1 || press the 1 on the key pad
|-valign="top"
|-valign="top"
|width="10%"|'''NUM2 press the 2 on the key pad
|'''NUM2 || press the 2 on the key pad
|-valign="top"
|-valign="top"
|width="10%"|'''NUM3 press the 3 on the key pad
|'''NUM3 || press the 3 on the key pad
|-valign="top"
|-valign="top"
|width="10%"|'''NUM4 press the 4 on the key pad
|'''NUM4 || press the 4 on the key pad
|-valign="top"
|-valign="top"
|width="10%"|'''NUM5 press the 5 on the key pad
|'''NUM5 || press the 5 on the key pad
|-valign="top"
|-valign="top"
|width="10%"|'''NUM6 press the 6 on the key pad
|'''NUM6 || press the 6 on the key pad
|-valign="top"
|-valign="top"
|width="10%"|'''NUM7 press the 7 on the key pad
|'''NUM7 || press the 7 on the key pad
|-valign="top"
|-valign="top"
|width="10%"|'''NUM8 press the 8 on the key pad
|'''NUM8 || press the 8 on the key pad
|-valign="top"
|-valign="top"
|width="10%"|'''NUM9 press the 9 on the key pad
|'''NUM9 || press the 9 on the key pad
|-valign="top"
|-valign="top"
|width="10%"|'''
|'''
|-valign="top"
|-valign="top"
|width="10%"|'''NUM* press the * on the key pad
|'''NUM* || press the * on the key pad
|-valign="top"
|-valign="top"
|width="10%"|'''NUM+ press the + on the key pad
|'''NUM+ || press the + on the key pad
|-valign="top"
|-valign="top"
|width="10%"|'''NUM- press the - on the key pad
|'''NUM- || press the - on the key pad
|-valign="top"
|-valign="top"
|width="10%"|'''NUM, press the , on the key pad
|'''NUM, || press the , on the key pad
|-valign="top"
|-valign="top"
|width="10%"|'''NUM/ press the / on the key pad
|'''NUM/ || press the / on the key pad
|-valign="top"
|-valign="top"
|width="10%"|'''
|'''
|-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 under Windows messaging, the ALT key needs to be depressed and released (ALT+ and ALT-) for every Alt-character specified.
Please note that the ALT key needs to be depressed and released (ALT+ and ALT-) for every Alt-character specified.


  alt+malt-alt+malt- works
  |alt+|m|alt-||alt+|b|alt-| works
   
   
  alt+mbalt- fails
  |alt+|mb|alt-| fails
   
   
  alt+mdownalt- works
  |alt+|m|down||alt-| works
   
   
This is because keyboard entries via Windows messaging doesn't interpret more than one letter as an alt value properly like it does via the keyboard itself. However it will honor arrow keys while the alt key is held down.
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.