A lesson we’ve learnt and you’ll learn today
Posted by Rifat Nabi on January 4, 2011
This post is targeted to developers.
Before I start, there should be a little introduction. May be you have heard that Bangladesh Election Commission has used Avro Keyboard in National ID card project. Before deciding to go for it, they knocked us with a “problem” that they cannot programmatically control keyboard mode (Bangla/English) of Avro Keyboard. They can generate F12 keystroke by an external software, Avro just ignores it. In their application there were many fields to type in, some requires Bangla, some English. If these fields could automatically control keyboard mode of Avro Keyboard, change it automatically when it needs Bangla or English without manually pressing the hotkey, the operators life would be much easier. Although what they reported was quite intended behavior in Avro Keybord and not a bug, we agreed to them and delivered them what they needed.
But still today, if you try generating F12 (say in your c# application) you will see that Avro just ignores it. Why is that? Haven’t we learned something from the past?
We explained them why. Avro Keyboard intercepts keyboard inputs, process them, and generates necessary keyboard input with Unicode characters according to that. Notice it, it generates keyboard input too. If it cannot distinguish what is a real keystroke and what is a generated, it will end up processing its own generated keystrokes. That won’t harm, but at the end efficiency matters, so it filters out all generated keystrokes at first chance.
Sorry, your generated F12 doesn’t get counted!
So, is there any way to mimic what Election Commission did, possibly in your data entry application? Indeed! The newly released Avro Keyboard 5 lets your application communicate with it in much easier manner.
Read on.
Method 1: Easier than anything. Suppose Avro Keyboard is located in “C:\Program Files\Avro Keyboard\Avro Keyboard.exe” and it is running. Just execute Avro Keyboard.exe again with “-bn” or “-sys” command line parameters (without double quotes), it will call the running instance of Avro Keyboard to change keyboard mode according to that. So, when Avro Keyboard is running, executing “C:\Program Files\Avro Keyboard\Avro Keyboard.exe -bn” will change its keyboard mode to Bangla, executing “C:\Program Files\Avro Keyboard\Avro Keyboard.exe -sys” will change its keyboard mode to English. Yes, I can see you smilling! ![]()
Method 2: How does method 1 work? If you have some expertise in win32 development, you probably have already guessed that. A little inter-process communication with windows messaging. If you want to do it manually, then of course you are a brave man and we do have a code sample (in c#) for you on how to do that!
Download it from here: Avro Keyboard Mode Switching Example
Related queries or comments are welcome.



অনেক ধন্যবাদ আপনাকে। এই একটা প্রবলেম আমাকে অনেক ভুগিয়েছে।
Wow, Good to see IPC in avro.
ধন্যবাদ
আরো কিছু প্যারামিটার থাকলে সুবিধা হত, যেমনঃ এনসি/ইউনিকোড সুইচিং, লে আউট চেঞ্জিং তারপরো যা পেলাম সেটাও খারাপ না।
ধন্যবাদ রিফাত।
সমস্যা হল -বাংলাটা আসছে কিন্তু F12 মারলে ইংরিজি না এসে অন্য বাংলা অক্ষর আসছে (l টিপলে ত ইত্যাদি) ।
Ami jodi Avro Keyboard Standard Edition 5.1.0 diye bangla lekhte zai tahole lekha ulta palta show kore. zemon ami jodi lekhte cai- kemon achen? thole lekha hoi – কেমন আছেন? mane e kar ta age na ase pore ase, keno emon problem hoi? kintu ami age avro 4.5.1 use kortam, tokhon kono problem hoto na. please amake janben. thanks