Macbook OpenEmu Python send keystrokes
<p>I am really impressed by <a href="https://github.com/pakoito/MarI-O" rel="nofollow noreferrer">this</a> MarlIO project and want to implement something similar using Python. However, I got the emulator <a href="http://openemu.org/" rel="nofollow noreferrer">OpenEmu</a> working, however, I don't know how to control the game using Python. </p>

<p>Isn't it just a matter of sending a few keystrokes?! Man, it is not that straightforward on a Mac. </p>

<pre><code>In [41]: cmd1
Out[41]: '\nosascript -e \'tell application "System Events" to key code 48 using {command down}\' \n'

In [42]: cmd2
Out[42]: '\nosascript -e \'tell application "System Events" to keystroke "a"\' \n'
</code></pre>

<p>I want to first use <kbd>COMMAND</kbd>+<kbd>TAB</kbd> to switch to the openEmu and then hit <kbd>a</kbd> to jump. However, when I ran the two commands, it only switched to the OpenEmu, looks like the keystroke <kbd>a</kbd> did not got sent. </p>

<p><a href="https://i.stack.imgur.com/pblXX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pblXX.png" alt="enter image description here"></a></p>

<p>However, when I ran 'cmd2' separately, it was clearly working. 
Then I testedit against a different application - sublime, and it seemed to work there. </p>

<p><a href="https://i.stack.imgur.com/bqmqo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bqmqo.png" alt="enter image description here"></a></p>

<p>Can anyone point me to the right direction what I really did wrong with OpenEmu? </p>