Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
KeyboardControl - an experiment with external keyboards
-
Simply put, this script analyzes the movement of the cursor and changes to the contents of a text field, and deduces what key(s) have been pressed to achieve the result. Afterwards both content and cursor are reset for the next keystroke. This is more of a proof of concept than anything else, but it could be used to control a UI script using an external keyboard. Or it could be used to make a WASD-controlled game by embedding a scene. Or for whatever else you might want to use an external keyboard for.
Caveats:
- Due to some weirdness with how the TextView delegate functions are called, the alt-backspace (delete word) and fn-backspace (traditional/forward delete) are not recognized correctly.
- The up and down arrow keys seem to "buffer up" for whatever reason, meaning that every number of up presses requires the same amount of down presses to return to normal operation. Pressing anything other than the up/down arrow keys will also reset the "buffer".
- The "control" text field is currently visible and not focused automatically, ideally it should be outside of the visible view area and focused on script launch.
- This script is probably utterly useless if you don't have an external Bluetooth keyboard for your iDevice.
You can find the UIPacked version of the script here. The unpacked .py and .pyui files can also be found in the same repo.