Teensy 4.1 - Macros triggered by mouse and keyboard

teamsy

New member
Hi, I would like to use the teensy board as an alternative to AutoHoKey.

It should trigger macros for certain physical keyboard and mouse inputs.

First I want to start with simple things.

Using a variable that is enabled with 2 and disabled with 1, the board should trigger a mouse click in an infinite loop as long as the left mouse button is pressed. Since I don't have any advanced code knowledge, working with the board is more difficult than I thought. After days of trying in vain, and even with the help of AI tools to assist me, I couldn't get it done.

Can anyone tell me if and how I can implement this with the Teensy board?



I am using the arduino ide again. In the meantime I also tried vscode.



Thank you very much.
 
Why do you need an alternative to AutoHotkey?

What is the setup? A Windows PC with a Teensy connected via USB?
It could be possible to connect the computer mouse to the Teensy via the USB host port. The Teensy can process the input and decides what exactly is passed through and what functionality should be added. The Teensy acts as mouse then.
Is that the idea?

If the mouse should stay connected directly to the PC, I don't see any other way than to use a software on that PC to do something.
 
The Teensy acts as mouse then.
Is that the idea?
That is exactly the idea.

An alternative is necessary because some AHK inputs are not recognized by the game(s). I hope this can be improved by the native USB function of the teensy.

I had hoped to be able to split the tasks in the teensy. Once to detect the keyboard/mouse (via the connection to the PC) and once to activate it as a HID device. But with the possibility that the teensy can react to the detected inputs. This did not work so far.

I got a hint. An additional script can capture the necessary data and send it to the teensy. The teensy can execute macros using the received data as a "real" mouse/keyboard.

I am optimistic, but it is just as tricky.
If anyone thinks this or any other approach is possible, I would appreciate help.

Basically, the idea is to take the strain off the fingers while playing, as it can get very uncomfortable over time.
 
It sounds that it would not be an option to have additional buttons connected to the Teensy to trigger the macros? That would make things easier.

Long ago I've worked with AutoIt. It is a script language where you can do many things under Windows. But as far as I remember you can only get keyboard input when the Window is active. I am not sure if there are ways now. Somehow AutoHotKey seem to be able to detect keyboard input in the background. So if you should find a method or script language that captures your keyboard input: Why not program the macros there?
 
....additional buttons connected to the Teensy...

That's not really possible. I use a real external macro board with buttons to trigger work and office tasks. This works very well, but it's not very suitable for games or at least fast games.

AHK is absolutely great, there's no question about it, which is why I still use it.
Unfortunately, some games do not recognize programmed inputs. If I had stored them in my mouse, it would have worked. So I'm wondering if I need an additional mouse/keyboard, in this case a Teensy with native USB function, to store them.

To be honest, I can't really get the script to work.
Maybe it requires much more advanced knowledge.

But I am still interested, if someone knows how to do.
I look forward to ideas and suggestions, if it does not work for sure, a message is also helpful.
 
Back
Top