Command Keys and Substitution Strings

SPFLite did not initially support direct interfacing with external scripting engines for macro support, although scripts could be launched using the CMD commands.  Because of this, a simplified variable substitution system was used to assist in creating custom CMD commands, and for key-mapped key definitions, PRINT SETUP strings, and SUBMIT codes.


Now, with full macro support available,the need for this variable substitution is gone,  but support is being retained until such time as it has been superseded.


Substitution Strings are values identified as a prefix of ~ tilde or ^ circumflex followed by a single letter code.  The letter code is case-insensitive and can be either upper or lower case; we show upper case here for clarity.




Currently, the following Substitution Strings are available:  


~F and ^F

This variable will be replaced by the current filename being edited. e.g. If editing C:\MyData\Letters\May01.txt, the ~F variable would become May01.  


~K(function) and ^K(function)

~K(keyname) and ^K(keyname)

~K(modifier-keyname) and

^K(modifier-keyname)


Here,

  • function is any primitive keyboard function in parentheses, such as (Date)
  • keyname is the “official” name of any key in the KEYMAP GUI as described with the “Current Key:” label.
  • modifier is an optional list of one to three letters from the list of C, A and/or S to indicate Ctrl, Alt and/or Shift.  When modifier is used, the letters C, A and/or S may each appear at most once for each one, may appear in any order, and are case-insensitive.  The modifier codes are separated from the keyname by a dash character.


Examples:

~K(Date)    

~K(F2)

~K(A-F1)


When the function notation is used, the listed function is used as-is, as if typed from a key-mapped key.  Only functions or keys that emit text, such as (Date) are permitted.


When the keyname or modifier-keyname notation is used, the corresponding key mapping for that particular key (as modified) is used to fetch the defined list of functions, text, etc.  Any characters in [ ] brackets or text which is unenclosed is treated as emitted text.


~L and ^L

Similarly to ~W, SPFLite will assign the contents of the current line on which the cursor is sitting to the ~L (line) variable.


~P and ^P

This variable will be replaced by the current path to the file being edited. e.g. If editing C:\MyData\Letters\May01.txt, the ~P variable would become C:\MyData\Letters.


~S(name) and

^S(name)

This variable will be replaced by the current contents of the defined SET variable called name.  It is an error if the SET variable called name is undefined.  ~S returns the value of the variable as-is, and ^S returns the value in upper-case.


~W and ^W

Each time the Enter key, or any other key mapped to issue a primary command is pressed, SPFLite will attempt to extract, if possible, the 'word' on which the cursor is sitting. This 'word' is made available as the substitution string (~W). This enables a mapped key definition to incorporate the 'word' into the stored command.


e.g.      X ALL; F ALL '~W'


If this were assigned using KEYMAP to the Ctrl-F key then this could be used as follows:

    • Place the cursor on a word or string of interest
    • Press Ctrl-F
    • The display will now show only lines containing the word of interest, all other lines will be in Excluded status.

Similarly,

       FIND FIRST '~W'

would, following the same instructions, scroll the screen to the first occurrence of the 'word' under the cursor.  


~X and ^X

This variable will be replaced by the current file extension of the file being edited. e.g. If editing C:\MyData\Letters\May01.txt, the ~X variable would become txt.


Created with the Personal Edition of HelpNDoc: Generate EPub eBooks with ease