Converting Serial input to Keyboard Button-press - java

Not sure if I'm asking this question on the correct site (I have been wondering if this should rather be posted on the EE.stackoverflow site).
So I have an OLD serial input mouse, and I want the system to reprogram or retranslate it to a keyboard button-press.
The whole thing is that I have software with shortcut keys, but remembering all of them is just not possible. So, why does one want to have a whole keyboard when one can only have a set of three buttons? Using a keyboard, when one presses F11 (and holds it in), it activates the system's mic. While holding in F11, one wants to press F1 to start playing music, thus being a voice over song application.
I've been trying to research the possibility, and I've come to notice that there are a LOT of applications that can convert a USB device, such as a game controller to a keyboard button-press. That's what's driving my concept.
Is this even possible?
Thanks,
Johan Brink

Well, as described here, if you are using Windows, you can use X-Mouse Button Control for mouse. If you want to use gamepad, try J2K - A Joystick to Keyboard Mapper 1.1

Have a look on Makey Makey (www.makeymakey.com). This is a board which emulates a key stroke each time one of his input is closed.

Related

Movilizer: Can I show numeric keyboard automatically and bypass the ok button?

I am working with Movilizer v15 in eclipse neon.
Currently, I am making a quiz, where people need to answer a number of questions with numeric values. But every question now consists of clicking on the answer (attributeType="2") to open the numeric keyboard, followed by answering, closing it again and pressing ok. This get's very tedious after a while.
So my question: Is there a way I can bypass opening the keyboard or having to click twice to move on to the next screen?
You can focus an Answer in the onEnterAssignment of a Question. If that Answer is of attributeType="2" this should open the numeric keyboard of the platform right away. If that keyboard allows "tabbing" forward, you can move from input field to input field. I think on Android the standard keyboard can do that.
focus(answ-desc answer, str clientKey)
Limitations might be
input fields across complex UIs
triggering OK event after the last input field is left

LibGdx Android Keyboard Autocomplete

I'm currently building a small game for Android using LibGdx in Android Studio. In the game the player uses the on-screen keyboard to enter different letters one by one.
My problem is that the autocomplete is one (since I use it when I'm texting) and this forces the player to click the "suggestion box" after every typed letter to actually make sure that the keyboard press and character input is registered. Since the input in my game should be one letter at a time I don't want autocomplete to try to "guess"/create a word.
I'm using the InputProcessor class with the "keyTyped(char character)" function. If I turn of the auto complete in phone settings (manually before starting the game) the input is registered and the correct character is passed in.
So, my question is if there is any way to turn off/toggle autocomplete programmatically?
Thanks in advance!
I realise this is old but if you or anyone else is looking for a way to do this then I have a solution. I built a completely new method for Android soft keyboard input to tackle the issues involved with the current libgdx methods. I am surprised to read auto-complete was actually working for you, because on all my testing devices it does not, and this is one of the problems I have attempted to solve.
I have built a sample project for people to work with that allows for much more reliable input using the Android soft keyboard, this includes swype, auto-correct, dictionary, etc. What you may be interested in is I have also included some customisation for the keyboard, such as the ability to disable auto-complete and suggestions. You would simply customise your TextFieldStyle with;
textFieldStyle.androidKeyboardAutoCorrect = false;
textFieldStyle.androidKeyboardTextSuggestions = false;
As of posting, no one has used this sample project and I have only tested on a few devices, so it may be a little erroneous. I will carry on maintaining it when/if feedback is received.
You can find it on Github here (source and executable apk)
If you have any comments/feedback please refer to Github or the badlogic forum topic
Hope this helps!

Pressing key at any point to make an action

I'm programming on java, so I have to make a game-like program. The game should be able to "pause" at any point. Can you press a key at any point so a message is displayed saying "game is paused"? Then when you press that key again it will say "game resumed"?
Thanks
It looks like you need to be able to read input directly from the keyboard into your game? Is your game built into a GUI or in the console?
This can be done by using the KeyListener interface Java provides.
https://docs.oracle.com/javase/7/docs/api/java/awt/event/KeyListener.html
I'll assume your using swing so this tutorial should be pretty useful.
http://docs.oracle.com/javase/tutorial/uiswing/events/keylistener.html
Sorry I can't go into more detail, more information about what you are trying to do in the comments would help me help you.
Edit: You mentioned you're using the command line. To get user input you can use java.util.Scanner
http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html
Make a boolean, isPaused. If space is pressed, switch isPaused from true to false or vice versa. If isPaused is true, run the game, if not, run a pause screen instead.

Can I simulate game pad button presses with Java's Robot class (Java.awt.robot)?

I'm using an Arduino Uno to hook a (genuine) SNES controller to a computer via USB or Bluetooth.
The Arduino captures the controller's button presses and releases using the snespad library. It communicates button presses and releases as characters (e.g. 'a' for pressing A, 'A' for releasing 'A'). Next, a Java program listens to the serial output using the rxtx library. Finally, a Java robot simulates key presses using the keyPress and keyRelease.
Unfortunately, this approach has a few drawbacks. The main issue is key mapping. I kind of arbitrarily decided which buttons would be which keyboard keys.
Java doesn't appear to have any game pad KeyEvents. When I say "game pad KeyEvent," I mean something like what the Android SDK has: http://developer.android.com/reference/android/view/KeyEvent.html (ctrl+f "game pad" or "button".)
My question is, is there a way to simulate game pad button presses instead of keystrokes using Java's robot class?
USING THE ROBOT CLASS IN JAVA
You can create virtual keypresses/releases in the following way...
Robot robo=new Robot();
robo.keyPress(KeyEvent.VK_A);
//don't forget to release it else you'll land up in infinite loop
robo.KeyRelease(KeyEvent.VK_A);
cheers
You should be able to easily from my expierience the gamepad buttons are mapped to keyboard buttons the only mapping i know it i,j,k,l go to looking around and w,a,s,d go to moving around

barcode scanner polling

I am working with a bar code scanner and java currently. i wanted to know wether there is a possibility to poll this device.
What I want: a popup message every time you scan a barcode
What I dont want: is to focus a text field first to do so.
I want this to run in the background so that the user only has to scan something without anything in focus. is this possible?
in other words, i dont want to use it like a keyboard but more like a sensor that informs me every time a new value is available.
thank in advance
i think these mostly work as keyboard input.
you could probably create a KeyListener() to check for the incoming values.
Yes you can listen barcode scanning detection on your whole hardware at anytime example:PC or Laptop or Tablet etc.
For that you need to add barcode scanner listener on your main file which is available to all the pages or all the urls of your application.
You can use my custome script from my answer on stackoverflow

Categories