Just reporting in to say a huge "thanks" for this features which, with a little tinkering, has brought back my beloved XKeys80 back from oblivion! No other keypad/keyboard combination has quite fitted my workflow so well, and I've done without it since OSX something killed ControllerMate.
I have all the keys successfully mapped for key presses - can I get a consult on the best way to tackle function keys, which need to have press and release mapped? Should I use BTT variables to store which keys are currently down and, if so, can I get/set them from the GD script? Or can I get the system report about which keys are currently down?
Can you give some more information about the F keys? Are their changes shown in the GD script?
You can use btt variables - to retrieve them you can use something like this:
let value = await callBTT('get_string_variable',{variableName:'theVariableName'})
However this is relatively slow. If you just need to store information, you can create a global variable before the analyzeDeviceInput function. Have a look here:
I've not explained myself very well - all of the keys are of the same type, but what I want to do is to map some to Ctrl/Option/Shift/Cmd. So I need them to be "held down" and not momentary, and need the key-down and key-up to be captured.
The solution by Back-To-Topic has proved a winner - I have adapted it for the Xkeys and all working perfectly - thanks both!
Many months of satisfied use with BTT and my X-Keys device later, I'm hoping to take the next step and see if I can control the lights on the device (to visualise another BTT preset). I have the spec of the device, and know the 36 byte hex arrays that I need to send it, and the report type that needs to be returned.
Can you suggest what format the data needs to be in for the Send Data To Generic Device to successfully pass it on, and what the report types should be set to? An example hex array would be:
However I have not tested this very much. The code of your example would respond with the device name, correct? This could only be tested with the "Run Real Java Script" action (I can post some example if you need that).
For just changing the lights, you probably don't need the return value though.