I want to use same key with different output values

I want to use ANSI keyboard
and the problem was i want to type same key with different output
example
prob 1:---------------

  • “s” > d246 d236
    [K_ENTER] + “s” > d246 (I want this)
    (But unfortunately the ouput is [K_ENTER] + “s” > d246 d236
    prob 2 :---------------
    & [K_TAB] + “s” > d246 (I want this)
    (But unfortunately the ouput is [K_TAB] + “s” > d246 d236

I made a temporary solution but it is not supported in Adobe Indesign.

  • [K_ENTER] > d13
    d13 + “s” > d13 d246

or

  • [K_TAB] > d9
    d9 + “s” > d9 d246

Any body pls help me. anvance thanking you.

Welcome to the Keyman community! I’m not sure why you want an ANSI keyboard, but I guess it’s still possible.

I do not believe that using K_ENTER or K_TAB is a good practice in keyboard development and Keyman does not support it. The only keys available for shifting layers in a keyboard are LALT, RALT, ALT, SHIFT, CTRL, RCTRL, LCTRL and CapsLock. Otherwise you should use the normal keys "abc,123, etc). You also cannot use the Function keys.

You could write a rule such as:

";" + "s" > d246

Since normally there is a space after a semi-colon this would work because there is no space after it.

i want ansi keyboard bcoz it works in pagemaker photoshop coreldraw & indesign also. Unicode fonts are not supported in pagemaker. I am from india. there are many languages i want to develop bengali keyboard
k_Enter & K_Tab works fine in corel draw & Adobe pagemaker except in indesing.
I use many multi language software. But this is best. but the problem is above said. I seen other typing software also it works well in all the above said softwares.

you said “;” + “s” > d246 but mam all the keys are already in use.
so i want to particularly K_Enter + “s” > d246

  • “s” > d246 d236 this is default value

I try this also
[K_Enter] + “s” > nul
nul + “s” > d246

the output result is

  • “s” > d246 …(+ “s” > d246 d236 this is default value )
    [K_Enter] + “s” > d246

A rule such as

[K_ENTER] + “s” > d246 d236

Is invalid.

The basic structure of a rule is

(contex) + key > output

The context is a sequence of zero or more codepoints. It can not be a virtual key.

[K_ENTER] is also a bad choice for a key. Different applications will intercept and use the keypress event for the Enter and Return keys in different ways. So Enter will to some state be application dependent, and operating system dependent. On Linux, Unix, MacOS in a text editor you will get a linefeed, in windows you will get a linefeed and carriage return, although cross-platform apps on windows may handle it differently.

For personal keyboards I use in house, i tend to use a US-QWERTY keyboard that has the [K_oE2] key, a couple of Korean keyboard manufacturers make US keyboards that have the additional key.

I will restress, i use this approach for inhouse layouts rather than as a productive mechanism on distributed keyboards.

I think what @barun_ghosh is wanting to do is identify the start of a text run, is that correct? That could be a paragraph mark, or a tab stop, or it could be an empty text field.

If that is the case, what you need to do is have a few rules to cover the different cases:

  nul + 's' > d246                  c start of a text run, nothing before the cursor
  d13 + 's' > context d246          c Carriage Return 0x0D
  d10 + 's' > context d246          c Line Feed 0x0A (possibly with 0x0D before it, doesn't matter)
  d9 + 's' > context d246           c Tab 0x09
  + 's' > d246 d236                 c Default case with no prefix

That covers the majority of situations where a new line or a tab character can be found in the text stream, without needing to deal with the Enter key or the Tab key directly.

Many Many Thank you Marc Durdin Sir, to understanding this problem. Your solution is best but still now the problem is arise when I start a paragraph or press enter for new paragraph or press tab in this situation ‘s’ > d246 get right key. But when I start a correction in the middle of a line then press ‘s’ the + ‘s’ > d246 d236 default case with no prefix is not working. Its get always ‘s’ > d246 WHY?
but when i typing a sentence if there was + ‘s’ > d246 d236 default case with no prefix is working fine.
Now what is the solution?
Advance thanking you Sir.

This is a limitation of the software that you are using – some applications such as Microsoft Word support Windows Text Services which allows Keyman to interact directly with the text, but older programs do not support this and so Keyman cannot detect what is at the cursor position when you click into the text. In those programs, Keyman has to treat this situation as though there was no content there.

To expand on Marc’s reply, since the application does not support the Text Services Framework, when you move the insertion point through the keyboard or mouse, Keyman no longer has the relevant information about the current input context.

The rule

nul + 's' > d246

would be fired. In this rule the context is nul, ie it is empty, there is no context, so this rule fires. See https://help.keyman.com/developer/language/reference/nul which says:

Be careful when using nul in the context. In legacy environments, such as many Windows applications, the context buffer will be
empty after cursor movement, menu access, or many other situations. This means that the nul keyword may match in situations where
you are not expecting it, for example in the middle of a word.

Your applications would be “legacy environments”.

1 Like