fingerlight
2017-07-19 05:07:00
I wrote this little script to input a middle mouse button press into MT:
MButton::r
In MT, as a test, I have a translator that has Key Stroke text r as its input . The output is 90 10 7F.
I can't seem to make this work. If I press the middle mouse button, I don't see the input or output in the log file. However, if I click in the Rules section, I see r when I press the middle mouse button, so MT is clearly getting the text input, but I don't seem to be able to get MT to act on it.
Steve
2017-07-19 06:17:40
comment
Could you please post your project file? I will take a look. If you see it in the BMT log, there should be no reason it is not working. Are you looking for the same case (lower case r?)
Steve
2017-07-19 06:35:47
comment
Also, are you looking for incoming or MIDI in. You will not see MIDI IN in the log window. Check incoming as well.
Steve
2017-07-19 06:57:28
In testing I ran into similar problem. Try closing your project and re-opening. That worked for me.
Also it is more reliable to use SendInput which is what I did
MButton:: SendInput r
fingerlight
2017-07-19 09:12:36
comment
Thanks Steve. That worked for me too. I also added the line
#ifwinactive Bome MIDI Translator Pro
so that the binding would only be active when in MT. Otherwise it made it impossible to type r without messing up.
Gabriel
fingerlight
2017-07-19 09:34:22
comment
uh oh… I thought #ifwinactive Bome MIDI Translator Pro was working to limit the binding to be active only when MT was running. It turns out it completely disables the binding … always.
Do you know of a way that enables the binding only when in MT. I think I would have to run the script every time I boot up. Is there a way to make MT run the script when I launch MT?
Thanks,
Gabriel
fingerlight
2017-07-19 09:56:00
I Googled the question about unbinding keys with a command in the Autohotkey script and found that I needed to use the name given to the running MT window. Windows Spy came up with SunAwtFrame
so the line below did the trick:
#ifwinactive, ahk_class SunAwtFrame
MButton:: SendInput ~
(note that I also changed the key sent to tilde in order to keep it out of the way of normal typing, or in case I decide to use some laptop keyboard inputs.
Thanks again for your quick responses,
Gabriel
fingerlight
2017-07-19 10:09:20
comment
One last comment (I hope)
In case anyone else tries to use Autohotkeys for a similar purpose…
Using ahk_class SunAwtFrame (the windows name for MT as it runs) worked only if MT was not only running, but the active window. This meant that when Ableton Live was the active window, as it normally is – and not MT – then the binding was not in effect.
The fix for that was to use the name revealed by Windows Spy for the active Ableton Live window instead.
Steve
2017-07-19 15:34:08
comment
Glad you have it worked out. You only want to send the ~ if MT Pro is active? I think if you want to send it while it is in the background, it will not work and I typically use MT Pro in the background while my other applications are open.
Also, beware that there is a setting in MT Pro to have it ignore keystrokes if it is the active (focused) window.
You can adjust these setting under View->Setting and then the Appearance tab.
Steve
2017-07-19 15:44:40
You can have MT Pro open an Autohotkey script on project opened. Incoming action project started. Outgoing action Execute file.
Note the other questions are more Autohotkey questions as opposed to MT Pro questions. However, with my experience with Autohotkey:
In Autohotkey you need to test if MT Pro is running and if not, ignore the keystroke.
I wrote a short Autohotkey script that can handle checking of a given process and posted it here. I send as an argument the process name I’m checking. You could probably adjust this and embed in your existing script instead of calling it from a different script.
See attached
Attachments:
Steve
2017-07-19 15:52:32
comment
If you want to direct a keystroke to a specific control, check AHK help file for ControlSend. But this is way out of scope for the Bome MT Pro Q&A site.
Steve
bome@sniz.biz
Independent Bome Programming Specialist
Bome Q&A moderator
fingerlight
2017-07-19 20:47:32
comment
Thanks Steve. Your advice for automatically launching Autohotkey on starting the MT project is the cherry on top! And, as usual, the combination of MT and Live has proven to be capable of achieving anything I fantasize about doing with my controllers.
Gabriel
Steve
2017-10-07 18:41:19
comment