2

I'm using Microsoft Keyboard Layout Creator 1.4 to create a custom Persian keyboard layout.
I want to define Shift + Space as ZWNJ ('‌' - U+200c) character like Persian (Standard) layout. However, when I want to build DLL and setup package, it doesn't accept ZWNJ as white space character. Here is the error in log file:

ERROR: 'VK_SPACE' in Shift State 'Shift' must be made up of white space character(s), but is defined as '‌' (U+200c) instead.

How should I solve this problem? Is there any alternative software?

2 Answers2

0

Any attempt in the Microsoft Keyboard Layout Creator to map the Space key to Shift+Space results in the following error message:

enter image description here

This is a limitation by Microsoft, perhaps worried about a user creating an unusable keyboard layout. It was already noted in a post dating from 2012 and hasn't changed since.

A solution must then come from a third-party product that gets the typed keys before Windows, such as AutoHotkey.

The following one-line AutoHotkey script will send the Unicode key 200C when Shift+Space is pressed:

+Space::Send {U+200C}

After installing AutoHotKey, put the script in a .ahk file and double-click it to test. You may stop the script by right-click on the green H icon in the traybar and choosing Exit. To have it run on login, place it in the Startup group at C:\Users\USER-NAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup.

Useful AutoHotkey documentation:

harrymc
  • 480,290
  • Thank you for your suggestion. However ,I don't want my keyboard layout to be dependent on a third-party software. – AmirSina Mashayekh Nov 10 '20 at 20:12
  • In this post from 2012 MKLC was unable to map any combination involving Space. If the latest version did not improve since then, you still have my answer. – harrymc Nov 10 '20 at 20:22
  • I have looked more into the problem, I even installed MKLC, and I can state that it cannot do what you want. With only Windows utilities you cannot solve this problem. – harrymc Nov 13 '20 at 08:56
  • If you are looking for a way to fix MKLC, that isn't within the powers of anyone who is not a Microsoft developer. – harrymc Nov 16 '20 at 08:29
  • Isn't there any other software which does the same (create an installable keyboard layout which isn't depending on any third-party software after installation)? – AmirSina Mashayekh Nov 16 '20 at 12:00
  • 1
    I checked already the ones I know, and they can't do Shift+Space either. I don't know why Space is a problem for the keyboard-layout programs. BTW, AutoHotkey is very versatile and can do much beyond key mappings, I count it as one of my best applications. – harrymc Nov 16 '20 at 14:06
0

No need to use any additional software. You indeed can setup U+200C as your defined character in MSKLC, BUT you will have to set it up as a dead key. Thus, set up the key as the usual U+0020 character, but enable the dead key feature. Therein can you set up any character you want, even if it is not a space. I have set up my space key to render U+2011 (non-breaking hyphen) with AltGr (Ctrl+Atl). The only disadvantage is that you will have to press it twice in order to get your character rendered.

Tell me if U+200C works as well.

Give a look at and mimic what I did with my custom layout.