Text-sensitive menu

Text-sensitive menus (TS menus) are used to execute commands when you type certain text. Typical usage - text replacement/autocomplete/autocorrect/autotext.

 

A TS menu has no visible interface. When you type text somewhere, and the text matches one of menu items, executes its command.

Triggers

A TS menu works only if it has a trigger.

 

Text trigger

Added in QM 2.3.3.

 

Assume you have this TS menu with 2 items (the "/b/i/c/p3" sets options):

/b/i/c/p3
sun :'"Sunday"
mon :'"Monday"

 

When you type "sun" and a delimiter character (for example space), it replaces the text with "Sunday " (erases "sun " and types "Sunday "). Or you can press Ctrl instead of a delimiter character. When you type "mon ", replaces with "Monday ".

 

This trigger does not require an event (hot-key etc) before typing text. It just tells QM to make the TS menu active. Only TS menus can have this trigger.

 

To assign this trigger, use the Properties dialog. You can set programs where the TS menu works, and a filter function. Also you can set prefix text; for example, if prefix text is ##, for the above menu you would have to type "##sun " or "##mon ".

 

Other triggers

Use if you need a hot-key or other trigger before typing menu item text.

 

Assume you have this TS menu with 2 items (the "/b/i/c" sets options):

/b/i/c
sun :'"Sunday"
mon :'"Monday"

 

Assume its trigger is key F12. When you press F12 and type "sun", it replaces the text with "Sunday". When you press F12 and type "mon", replaces with "Monday".

 

Assume it's trigger is key `, and "Eat" is unchecked. When you type "`sun", it replaces the text with "Sunday". When you type "`mon", replaces with "Monday".

 

You should not use alphanumeric keys for trigger. Instead use text trigger. If using alpha keys and option /i (case insensitive), also set third state for Shift checkbox in Trigger tab.

 

Notes

QM 2.3.3. A TS menu cannot work if it doesn't have a trigger. If you want to use mac or other way to activate it, at first assign a trigger. It can be any trigger except text trigger. Also, a TS menu will not work if it or QM is disabled.

 

QM 2.3.3. All TS menus don't work if disabled in Options -> Triggers, regardless of trigger type.

Menu items

TS menu text is a list of items, each in separate line. Item format:

 

text :statements

 

text - text that you must type to execute statements.

statements - any commands that you can use in macros.

 

Separator between text and statements is single space and colon ( :). For example, if trigger is key `, and menu contains line mail  :"name@abc.com" (two spaces after "mail"), the command is executed when you type "`mail " (with space).

 

Lines that don't have  : and don't begin with / are ignored and can be used for comments.

 

QM 2.3.3. Lines that begin with space are comments. If need space, use escape sequence [32].

Options

Lines that begin with / are used to set options for following items (until next such line). To set options, you can use the Properties dialog. Options:

 

/s Select the typed text. Uses Shift+Left keys.
/b

Erase the typed text. Uses Backspace key.

  • You can use either /s or /b, not both.
/i

Case insensitive.

/c

If first character of the typed text is uppercase, capitalize first character of the first paste or key.

  • It works with key "text" and key (variable), but not with key text. Not with str.setsel.
  • QM 2.3.3. It works in whole thread. previously didn't work in functions called from the TS menu.
  • QM 2.3.3. If all typed text is uppercase, capitalizes all text of the first paste or key command.
  • QM 2.3.3. This also adds "case insensitive" option.
  • /s or /b also must be set. If not, this option works only if all typed text is uppercase.
/m QM 2.3.3. With confirmation. Shows a popup list (read below) containing single item.
/p1

QM 2.3.3. Need a delimiter character (postfix) to execute an item.

  • For example, menu item "test" will be executed when you type "test ", or "test," or "test.", etc.
  • Delimiter characters are all characters except alphanumeric and those specified in Options -> Triggers.
/p2

QM 2.3.3. Need to press Ctrl to execute an item.

/p3 QM 2.3.3. Need a delimiter or Ctrl to execute an item.

 

This example sets "select text", "case insensitive" and "capitalize" options for items that follow:

/s/i/c

 

You can also add and remove options for each item separately. To remove, use uppercase characters. In this example, /C tells that "capitalize" option must not be used:

 

/C/ pw1 :"password1"

 

If you need / character at the beginning of item's text, use //.

Multiple matching items

QM 2.3.3. If multiple menu items match typed text, shows a popup list.

 

List item text is extracted from menu item code or comments. Example:

 

text :'"This will be list item text"
text :'"zzzz" ;;This will be list item text

 

Keyboard shortcuts:

 

To show this for a single item, use option /m.

Notes

To prevent excuting a TS menu item, while typing its text (not before) do one of the following:

 

A TS menu item will not be executed if a non-delimiter character (alphanumeric + specified in Options -> Triggers) was typed previously, unless trigger is a key with "Eat". To execute anyway, before typing do one of the above (click, Ctrl, etc).

 

You can associate sounds with TS menu events: Options -> Sounds.

 

QM 2.3.3. Works in console windows.

 

QM 2.3.3. Removed 5 s timeout.

 

QM 2.3.3. Default opt keymark is 1. It makes more reliable. In called functions it is 0.

 

QM 2.3.3. You can use function TriggerInfoTsMenu to get user-typed text and other info about menu item.

 

Usually in TS menu items you use an "insert text" command. To insert text, can be used keyboard (key) or clipboard (paste). For short text it's better to use keyboard, because it does not erase clipboard, however it can be too slow with quite long text. For items where code is simple text in double quotes (like abc :"text"), QM uses clipboard or keyboard, depending on hybrid paste setting in Options -> General.

 

May interfere with other running keyboard/autotext software, or with similar features of the target program, eg Microsoft Word autocorrect.