External/USB controller integrated with Eclipse - eclipse

I own an APC MINI USB/MIDI button pad and have been trying to get windows to more or less recognize it as a operating-system-wide input device. My primary use case is to trigger macros or shortcuts in Eclipse.
For example, instead of the current keybinding of ALT+] to clone a window I could press [btn_1] on the external controller to trigger the action. Another example is I could move the slider up and down changing the zoom on my text.
Ideally I'll be able to fire off any macro or shortcut just by pressing a button on the USB pad. If I could get it working at the OS level, I could see having a row of buttons start or focus frequently used applications. For example be able to open FireFox or press a button to navigate a tab to StackOverflow.com.
I supposed I COULD slap together a quick jar with a Midi library, listen for input from the device and map the "notes" (button presses) to a key combination/shortcut but I feel like there has got to be a way to have windows treat the pad as an input device just like a mouse or keyboard. Been all over the internet looking for solutions but most use cases deal with software engineered to handle midi input. Not afraid to write .bat files to cooperate with windows but still need some way to link the buttons on my board to said .bat files.
Any ideas or suggestions would be greatly appreciated!

Related

Issues with irrecord lirc function

I am trying to setup a remote to work with an IR reciever that I recently purchased using my raspberry pi, I've installed LIRC according to the following tutorial
https://www.digikey.com/en/maker/blogs/2021/how-to-send-and-receive-ir-signals-with-a-raspberry-pi
now the problem arises when I try and record to setup a specific remote, it saves all the values as 0x0,
here is the console output when setting up the remote that doesn't work
Running as regular user pi
Using driver default on device /dev/lirc0
irrecord: could not open logfile "/home/pi/.cache/irrecord.log"
irrecord: Permission denied
irrecord - application for recording IR-codes for usage with lirc
Copyright (C) 1998,1999 Christoph Bartelmus(lirc#bartelmus.de)
This program will record the signals from your remote control
and create a config file for lircd.
A proper config file for lircd is maybe the most vital part of this
package, so you should invest some time to create a working config
file. Although I put a good deal of effort in this program it is often
not possible to automatically recognize all features of a remote
control. Often short-comings of the receiver hardware make it nearly
impossible. If you have problems to create a config file READ THE
DOCUMENTATION at https://sf.net/p/lirc-remotes/wiki
If there already is a remote control of the same brand available at
http://sf.net/p/lirc-remotes you might want to try using such a
remote as a template. The config files already contains all
parameters of the protocol used by remotes of a certain brand and
knowing these parameters makes the job of this program much
easier. There are also template files for the most common protocols
available. Templates can be downloaded using irdb-get(1). You use a
template file by providing the path of the file as a command line
parameter.
Please take the time to finish the file as described in
https://sourceforge.net/p/lirc-remotes/wiki/Checklist/ an send it
to <lirc#bartelmus.de> so it can be made available to others.
Press RETURN to continue.
Checking for ambient light creating too much disturbances.
Please don't press any buttons, just wait a few seconds...
No significant noise (received 0 bytes)
Enter name of remote (only ascii, no spaces) :notworking
Using notworking.lircd.conf as output filename
Now start pressing buttons on your remote control.
It is very important that you press many different buttons randomly
and hold them down for approximately one second. Each button should
generate at least one dot but never more than ten dots of output.
Don't stop pressing buttons until two lines of dots (2x80) have
been generated.
Press RETURN now to start recording.
................................................................................
Got gap (108172 us)}
Please keep on pressing buttons like described above.
.....................................................................................................................................................Cannot find any gap, using an arbitrary 50 ms one. If you have a
regular remote for e. g., a TV or such this is probably a point
where you hit control-C. However, technical hardware like air
condition gear often works without any gap. If you think it's
reasonable that your remote lacks gap you can proceed.
Press RETURN to continue.
Please enter the name for the next button (press <ENTER> to finish recording)
KEY_UP
Now hold down button "KEY_UP".
Please enter the name for the next button (press <ENTER> to finish recording)
KEY_DOWN
Now hold down button "KEY_DOWN".
Please enter the name for the next button (press <ENTER> to finish recording)
KEY_LEFT
Now hold down button "KEY_LEFT".
Please enter the name for the next button (press <ENTER> to finish recording)
KEY_RIGHT
Now hold down button "KEY_RIGHT".
Please enter the name for the next button (press <ENTER> to finish recording)
KEY_OK
Now hold down button "KEY_OK".
Please enter the name for the next button (press <ENTER> to finish recording)
Checking for toggle bit mask.
Please press an arbitrary button repeatedly as fast as possible.
Make sure you keep pressing the SAME button and that you DON'T HOLD
the button down!.
If you can't see any dots appear, wait a bit between button presses.
Press RETURN to continue.
...Cannot find any toggle mask.
Successfully written config file notworking.lircd.conf
Here is what the config file that's generated looks like
Now, if I setup another remote I have laying around I get a correct config file
Here is a picture of the two remotes sitting side by side, the remote on the left is the one that is not working
I've tried using this tutorial too to no avail
https://www.raspberrypi.org/forums/viewtopic.php?t=235256
does anyone know what's going on here?

How to write a command line interface in Swift 4 with features similar to Unix man pages?

For example; go ahead and open a terminal window and type:
man ls
Have a look around; notice that you can move up and down through text with the arrow keys and that the terminal history is now missing.
Use "q" to quit.
The terminal history is now returned.
I'm trying to understand how to write an interface that does the above: with the terminal history disappearing and reappearing on exit and most importantly with the interface being able to take key presses as input instead of using readLine().
On the screen clearing front I've managed an ANSI escape code:
print("\u{001B}[2J")
Which clears the screen and starts the cursor from the bottom but is only really implementing newlines and pushing the old content off the screen unlike the man pages which remove the scrollable history. So currently not what I'm trying to achieve.
As for taking key presses as input, I haven't been able to find much but Foundation has 3 references to:
standardInput
The Developer Documentation lists them in FileHandle, NSUserUnixTask & Process. I'm hoping perhaps one of them may be able to listen for key presses and then respond with a notification that I can use to update my interface with the correct screen clear and repositioning of text or perform an action (like quitting and returning to the normal prompt as "man" does with the press of "q").
Would love to have some help on this one, thanks!
The standard macOS Cocoa GUI uses events; representing mouse clicks, keyboard presses, etc.; to communicate user input to your app. Read up on event handling and you can make your app quit which the user types a "q". That is the underlying mechanism for keyboard input and the alternative to your readLine().
However what you are describing is more involved than just key press handling, you want terminal-like screen control; scrolling backwards, clearing the screen, etc. The original way of doing this on Unix was to use low-level tty device interfaces and issue control codes the screens themselves understood. The modern was is often to implement these same control codes in your Cocoa interface, this allows the output of the standard Unix-level commands; e.g. man et al; to be interpreted. This is what Terminal.app does. The standard Cocoa text controls also implement support for some of this, in particular a subset of Emacs-style cursor movement is supported.
The open source iTerm2 is an Objective-C alternative to Terminal.app, the source is available on GitHub. If you read this you can learn how to implement a terminal window interface in Cocoa in Objective-C, you'll have to figure out the Swift equivalent.
HTH

Inject OnClick Event into running EXE

Is it possible with some program to to send an OnClick Event eg: MenuNewClick (File New) or others.
I have an application that has no Keyboard shortcuts.
When I use a Resource Editor I can see the Delphi Forms for each OnClick Event I need.
I would just like to be able to send these OnClick Events with Keyboard Shortcuts into the running exe.
Have used apps like Darker's Enabler, EDA Preview that allow you to modify the layout of a running exe.
Possible ?
Even this forum has options "Keyboard shortcuts
Enable keyboard shortcuts (when enabled, press ? for help)"
Thanks.
If the application is indeed made with Delphi and if it uses default TMainMenu component you could modify the RCData in which the .dfm is stored (this data alows you to view the form and its properties with programs like PE Exporer and similar) in a way that you change the AutoHotkeys property of TMainMenu to maAutomatic and then change ShortCut property of each menu item to contain proper keyboard shortcut.
If you have access to Delphi I recomend you first make an example application which will have all available shourctuts implemented so you could comparison the RCData between these two applications and made necessary changes.
NOTE: What I'm suggesting will require editing the EXE resource data so make sure you are working on a copy of the exe and not on the real one so you don't break your application.

Macro Keys not Detected AutoHotkey

I have just purchased the Steelseries apex gaming keyboard and rival mouse. Unfortunately, each of these products has different software for macros and keyboard lighting, both of which are mediocre at most.
Instead of having 2 processes running in the background and having to use 2 crappy programs to write my macros, I have decided to use AutoHotkey for my macros, some of which I plan on making quite complex. The mouse was no problem in AutoHotkeys, with the two side buttons using XButton1 and XButton2, however no matter what I do, I can't detect my keyboard macro keys (M1 to M12 and MX1 to MX10).
Using a keyboard hook doesn't detect any keys, and looking online I can't find how to reference these keys either. I'm not even sure windows sees them, as when I try to input them into the shortcut key field in a normal shortcut they do nothing. So my questions are:
What is the name for the macro keys on my keyboard in AutoHotkey?
Is there any way to work around this problem without having to use the Steelseries Engine?
If I can't access them normally, is there a way to reassign them without external software?
(Optional) Is there any way to adjust the lighting on the keyboard and mouse without the Steelseries software as well?
Btw I'm using Windows 8 and here are the links to the mouse and keyboard. Thank you in advance.
You can get the name for special keys that are not listed in AutoHotkey documentation by following steps here.
Some notes and explanations:
You can use that script for step 1:
#InstallKeybdHook
Sleep, 99999999999999999999
When you run it, check if keyboard hook is active by:
press here:
then here:
and if active, you should see something like here:
In the step 6 the hex value column is here:
If that is not working for you, try Alternate solutions in the link that I provided before.

How to ID a control with Windows Spy?

Newby here...I have my first script running...yeah! But I'd like to read some window controls. I see in the AHK Help for GetControlPos and others:
Can be either ClassNN (the classname and instance number of the control) or the name/text of the control, both of which can be determined via Window Spy.
Duh, I can't find the info in Windows Spy. Can someone point me in the right direction...TIA.
You have to hover over the controls with you mouse. In the "Under mouse" section you will see what can be gathered from the application. In quite a few situations, you will not see more that the colour under the mouse. When the application has named controls, you will then see the ClassNN name/ID.
In short, not all programs have named controls.
You can test with e.g. Notepad and in Notepad use file save. The file save dialog has named controls.