AutoHotKey doesn't recognise the Shuttle Xpress - autohotkey

For some reason, I need the Shuttle Xpress keypad to map to keys like "Caps lock + v", "Ins + a". But the shuttle doesn't recognise the "Caps lock" as a modifier key. It can only map "Caps" or "Ins" alone. I try to use AutoHotKey software, but it failed to catch the shuttle's input signal.
The shuttle has its own driver. How can I catch the Shuttle Xpress signal, and map it to any key combinations I want?

You MIGHT be lucky and the device may be a "HID" device.
Most input devices (All keyboards, mice, "normal" joysticks, XBox controllers, PS4 controllers, etc, etc) are HID devices.
From a cursory google, it seems that it is a HID device or there is maybe some mode you can put the device in to make it a standard HID device?
In which case, AHK natively cannot read it, but it can be done through WinAPI calls (DllCall()) to the RawInput API.
There is a library called AHKHID that will let you read HID devices from AHK, and I am working on similar solutions (Though mine these days are tending to be written as a C# DLL which you then call from AHK), but I don't think I have anything that could help you at the moment - I have only implemented mouse movement in RawInput so far.
If / when I do though, I would post it on the AHK forums (I post as evilC), so keep an eye out there.

I made a workaround that enables me to map ShuttleXpress buttons to any keystroke sequence or scripts. The input is routed to ahk via the Fn keys. This works very well for my use, could be worth a try.
1: Remap Shuttle Xpress buttons to function keys between 13-24. (1-12 is of course also possible, but then you would tie up the physical Fn keys on the keyboard.)
2: Use ahk to remap the same function keys to any script or keystroke.

Related

Identify a keyboard with ps/2 bus

I am writing a keyboard driver for my custom OS. I have a PCI driver that can return the vendor ID and friends. However I searched on internet if it's possible to communicate directly with the keyboard and identify it directly. I found nothing.
My question is : Can I get a string from the keyboard that identify the keyboard directly using in / out commands ? ( for example "Logitech Keyboard" )
The keyboard communicates with a ps/2 interface
Has someone an Idea ?
This is a nice detailed doc about the ps/2 keyboard protocol: https://www.avrfreaks.net/sites/default/files/PS2%20Keyboard.pdf
There doesn't appear to be anything that would tell you some textual identification of the keyboard. I don't think you can even find out how many keys it has.
Short version: no, you cannot.

Observing System Volume Changes OSX - Swift

I'm trying to execute a method when the system volume changes.
I've tried using
DistributedNotificationCenter.default().addObserver(self,selector: #selector(volumeChanged(_:)),name: NSNotification.Name(rawValue: "com.apple.sound.settingsChangedNotification"),object: nil) but it didn't work.
Well, it does work. But only if the System Preferences app is open.
What's the right way to accomplish this task?
Ps: note that it's on MacOS, not iOS
After trying countless ways I found a nice workaround: instead of searching for a probably non-existent notification, I try to get the physical key-press event.
As the media keys are not sending a normal CGEvent I came up with this solution: Capture OSX media control buttons in Swift
Note that the TouchBar simulates such a key event, so any app that you'll write using this method will also work for those MacBook models which have the TouchBar.
It's probably not the ideal solution, but it works. If anyone knows a better way please let me know.

Osascript in Yosemite broken/slow - anyone can confirm?

During 10.8 times I created macro in Keyboard Maestro for adding web pages to Reminders list to read them later.
In Mountain Lion and Maverics it worked fine but in Yosemite something wrong is going on resulting very slow executions.
Previously execution time was about 1-2 seconds now its over 40 seconds or even one minute!
Apple team provided me with wrong solution ordered to "code sign" my script, but there is no "file" to codesign and applescripts can be executed in command line. So IMO they messed up something in osascript and still couldn't fix it till 10.10.4. But I need someone to confirm or to advice me how to debug problem, because I cannot find in system console log lines relevant to problem.
UPDATE:
On El Capitan 10.11.1 problem still persist.
Macro
Could anyone test and confirm this? I provided link to macro.
It is bind currently to F1 - change as you like. Before execution create "2Read" list in Reminders on OSX.
I've tried it and it's done in about 1-2 seconds on my machine. So I do not experience the same problem as you.
I'm running OS X 10.10.4 on a late 2013 MBP Retina.
Maybe your "2Read" list is too long?
Another tip:
I used to have a problem with long lists in Applescript, too. Sometimes it would take minutes to run through a list, but after using some if these tips the time for the lists was brought back to only seconds.
From your pastebin link (yeah, I did warn you it'd look like mince):
Keyboard Maestro event logs
(1) KM sends an 'open' event ('aevt/odoc') to Growl, telling it to open a temp file (presumably to make Growl display a message)
(2) Bartender sends a 'get scripting terminology' event ('ascr/gdut') to KM
(3) Bartender sends a 'BTDR/Load' event to KM, which looks like Bt telling KM to load a plugin named "BartenderHelperNinetyOne.bbundle"
(4) KM send a 'KeyC/KeyB' event to something (it doesn't give the name of the process, only its Process Serial Number, which is the classic MacOS equivalent to a Unix process ID). Probably easiest just to ask the KM devs about that one.
(5,6,7) KM then sends three 'application died' events ('aevt/obit') to Keyboard Maestro Engine (I'm guessing that's a faceless helper app that runs constantly in the background), informing it that three osascript processes (PSNs 312312, 315315, 316316) have terminated. This doesn't necessarily mean that osascript has crashed as those events contain an error number ('errn') parameter with value 0, and command-line processes normally return error code 0 to indicate they've completed successfully. It's quite likely these are normal internal notifications sent between KM and KME to indicate when a task is completed. The first of those osascript processes (PSN 312312) is related to the Reminders activity below; the other two I'm guessing are you running other AppleScript macros and probably not relevant here.
Reminders event logs
(1,2,3) The 'osascript' process with PSN 312312 sends Reminders a 'make' ('core/crel') event and two 'set' ('core/setd') events, which is obviously your AppleScript being run.
(4) The Dock sends it a 'reopen' ('aevt/rapp') event, which is probably just you clicking on Reminders' dock icon to bring it to the front.
The main problem, of course, is that without timestamps I can't tell you where your 40-second delay is occurring. You'd really need to do it again, this time manually noting the time at which each message is logged. And if you see a single 40-second delay somewhere in the middle, it should easy enough to determine which events it's occurring inbetween, which should start to point towards a cause. At which point, you're probably best contacting the KM vendor to discuss it with them.
HTH

Simulate input of a 3D Mouse in autohotkey

I want to use autohotkey to control a program, which relys on the input of a 3D-Mouse (3DConnexion SpaceNavigator). How can I simulate a axis in autohotkey?
Maybe 3DConnexion SpaceNavigator uses same axeses as joystick? So check joystic controls here: http://ahkscript.org/docs/KeyList.htm#Joystick
If it does not helps, you can try to get the name of the control with that guide: http://ahkscript.org/docs/KeyList.htm#SpecialKeys (some explanations here: Macro Keys not Detected AutoHotkey)
By the way please write your impressions about 3D-Mouse (3DConnexion SpaceNavigator) in comments.
I think you need to get the SDK and write your own intigration...seems to be the only option, unless you figure out a way to communicate with the device by watching the usb signal

Is it possible to map a key press to simulate middle-click in xwindows?

I'm wondering, is it possible to somehow map a key-press event to act like a middle-key click of a mouse in Xwindows? They are diffrent devices, I know, but if there was a way to trigger a middle-button click event from a C program, it should be easy to bind a key to it using existing xwindows mechanisms.
Xevent does the trick:
http://www.isv.uu.se/~ziemann/xevent/
http://linuxgazette.net/153/misc/ziemann/xevent.c
The code compiles and runs just fine on my machine.
If you are interested as a developer: It uses the XTest extension, which is included in the X server. There is also some old, still valid documentation of that API online:
http://www.xfree86.org/current/xtestlib.html