FacetCorp


This FacetTerm technical application note originally appeared in FacetNews, the FacetCorp newsletter. In it are examples of using hotkeys to simplify repetitive tasks and details of the one-touch copy and paste trick. If you have trouble trying to use any of these ideas, please contact FacetCorp technical support for assistance.

Hotkey Happiness   8^)
By Eric Yundt

FacetTerm hotkeys are a powerful yet easy-to-use feature that can pole-vault any user's productivity to a higher level. Hotkeys or "key macros" can simplify repetitive data entry, automate simple tasks, and input complex keystroke sequences for you, all with the touch of a single key. FacetTerm hotkeys can be created on-the-fly as you need them (via the Window Command Line prompt), or can be automatically created by FacetTerm using a "keymap" file. Below are examples of using both methods and some of my favorite, life-sustaining hotkeys.

The idea behind hotkeys is simply to use one key to do the job of many. If you find yourself regularly entering the same keystrokes, reducing them to a single hotkey can not only save you time and finger skin, but can ensure accuracy by avoiding typographical errors. For instance, if you need to enter your telephone number frequently throughout the day, you could simplify the process by having FacetTerm re-map the "<CTRL>P" key to enter the number. Whenever you press "<CTRL>P", your telephone number would be entered automatically, saving you quite a bit of typing!

Temporary hotkeys can be created from the Window Command Line prompt by entering the Window Command Line hotkey (default is "<CTRL>W"), followed by a colon ":", "M" for macro, the key you want to re-map, and then the keys you want it mapped to. For example, to re-map "<CTRL>P" to our telephone number, enter:

<CTRL>W:m^P214-985-9901

Please note that Window Command Line commands (":m") and control character names ("^P") are not case sensitive. A control character ("<CTRL>P") as part of a command should be entered literally as "^" and the letter ("P"), not the actual control character ("<CTRL>P"). However, the Window Command Line hotkey must be entered as the actual control character ("<CTRL>W").

To have FacetTerm automatically create this hotkey each time it starts-up, you must make a "keymap" file and tell FacetTerm to load the file via the ".facet" file. First create the "keymap" file -- it can be put in the $HOME directory for personal use, or in "/usr/facetterm" for system-wide use. You can name the file whatever you want, but if you name it ".facetmap" you won't have to specify a filename for FacetTerm in the ".facet" file. In this case, let's call it ".facetmap". The format of the "keymap" file is simple. Each hotkey needs a single line starting with "map", followed by a <TAB>, the key to re-map, another <TAB>, and then the keys you want it mapped to. For example:

###########################
# FacetTerm Hotkey Macros #
###########################
map    ^P     214-985-9901

Note, each line must start in the first column and lines starting with a "#" are considered comment lines that are ignored by FacetTerm. Don't forget, the "^P" is literally a "^" and a "P" -- not a "<CTRL>P".

After the "keymap" file is created, modify the ".facet" file so FacetTerm will automatically load the "keymap" file upon start-up. Find and uncomment the line in the ".facet" file, "# keymap=".

keymap=
# keymap=mykeymap

Note, we didn't need to specify the filename because we used ".facetmap", otherwise we would have had to specify the filename after the "keymap=".

Special characters are specified the same way in "keymap" files as they are in "function key" files (see Making FacetTerm Function Key Files on page 187 of the manual for details). A few of the commonly used special characters are: "\s" for SPACE, "\h" for the Window Command Line hotkey (default is "<CTRL>W"), and "\r" for RETURN.

Hotkeys are a GREAT way to simplify FacetTerm commands. For example:

#############################
# FacetTerm Command Hotkeys #
#############################
# change to next/previous active window
map    ^N     \h+\s
map    ^P     \h-\s
# toggle between last two windows
map    ^O     \hl
# run "mail" program in 1st available window
map    ^E     \hrmail\r
# re-activate idle window
map    ^A     \ha
# activate screen saver
map    ^X     \hxsy

With a little careful planning, hotkeys can be used to automate complex tasks. In this real-life example, our FacetTerm customer is running a database program in Window #1 and a spread-sheet in Window #2. The job calls for looking up a year-to-date sales figure for each customer from the database screen (line 5, columns 10 through 15 to be exact), and then inputing it into the spreadsheet. Traditionally, you would manually write down the sales figures on a piece of paper and then re-enter them into the spreadsheet. However, with FacetTerm, all of this is accomplished with the press of a single hotkey at each customer's database screen.

##############################
# FacetTerm Masterful Macros #
##############################
# plug YTD sales into spread-sheet
map    ^T     \hcUddddLrrrrrrrrr\rrrrrr\r\h2\hp\r\h1

This is a good example of taking advantage of several FacetTerm features. Let's decode it for better digestion. ;-) The keystroke sequence being mapped into the "<CTRL>T" hotkey is:

\hc           ^Wc - start the FacetTerm Copy command
Udddd         Go to the very top line of the screen and then go down 4 lines
Lrrrrrrrrr    Go to the very left column of the screen and then go right 9 columns
\r            Enter RETURN to mark the 1st corner of the Copy Block
rrrrr         Go to the right 5 columns
\r            Enter RETURN to mark the 2nd corner of the Copy Block
\h2           ^W2 - change to Window #2
\hp           ^Wp - paste the contents of the copy buffer at cursor in spread-sheet
\r            Enter RETURN to go down one line in spread-sheet
\h1           ^W1 - change back to Window #1 and go on to the next customer

As you can see, you are only limited by your imagination and the size of your keyboard!

When picking a key for use as a hotkey, make sure that the key is not already being used. Some keys may already be in use by other applications and some may be special keys used by the UNIX system. For instance, "^S" is commonly used as the XOFF character for serial line flow control. Keys that are often good to try are: ^Z, ^X, ^N, ^G, ^E, ^T, ^Y, ^O, and ^P. While it's generally not a good idea, you can use regular keys as hotkeys. It's just as easy to use "T" as a hotkey as it is to use "^T" -- a regular "T" is just more likely to be needed in the normal course of data entry.

Eric Yundt is a member of the FacetCorp Technical Support staff and is also FacetCorp WebMaster. He can be reached at (214) 985-9901 or by email at Eric@FacetCorp.COM.