Before moving on to the real question, I will say that although I am currently working in Python, I will make a decision in ANY language. I am mainly a Java programmer, but since Java is pretty limited by its JVM, I did not think it would be possible to create it in Java.
Purpose:
I am trying to create a program that will capture keyboard events (I already did this part with pyHook, this is one of the main reasons I program this in Python). Based on these events and context, I need to write Unicode characters (ancient Greek) in any focused window (currently only on Windows, but a uniform solution that will work on all OSs seems perfect). Basically, this is a program that allows me (a student of the classical language) to enter the ancient Greek language.
Problems:
Everything works fine until I need to send Unicode characters like alpha, delta or omega using sendKeys. The hook works great, and SendKeys works great with regular ASCII characters. I tried the following libraries to no avail: (Sample code below)
- SendKeysCtypes (contrary to what the blog says it does NOT support Unicode)
- win32com.client using shell and SendKeys.
- SendKeys (Another library does basically the same thing)
Now that I have outlined my current situation, I have the following questions:
Questions
<i> 1. Is it possible to use Unicode characters with SendKeys? (Google searches so far indicate that this is not possible).
Since this is probably not the case, I wonder:
<i> 2. Is there another library that can send Unicode characters to a focused window?
, , , ( ). , , , , .
import time
import win32com
import win32com.client
shell = win32com.client.Dispatch("WScript.Shell")
shell.Run('notepad')
time.sleep(0.1)
shell.AppActivate('kladblok')
shell.SendKeys("When Unicode characters are pasted here, errors ensue", 0)