Convert Keystroke to another Keystroke without executing original keystroke

bdumaguina

2016-10-01 14:38:23

I am remapping my function keys, F1 and F2 to NumPad - and NumPad + respectively, to be able to control Zoom In and Zoom Out in Ableton Live. Problem is, F1 and F2 is natively mapped to Mute Tracks 1 and 2 respectively.

Although I am successful in getting the Zoom In and Out functions to work, I am also Muting Track 1 and 2 simultaneously.

Is there a way with Bome Midi Translator Pro, to disable the original function of F1 and F2? I prefer using F1 or F2 since it is closer to my left hand, as most shortcuts are closer to left hand while right hand is on the mouse when producing music.

Also, if there is an alternative way to go about this, I'm all ears.

Thank you,
Bryan

florian

2016-10-01 15:26:37

Hi Bryan,
I'm sorry, you cannot remove (swallow) keystrokes with MT Pro. I'm not sure it's possible at all...
Regards,
Florian

bdumaguina

2016-10-01 18:48:22

Hello Florian,

Thank you for responding.

Any other alternatives out there? I'm all ears guys.

Thanks again,
Bryan

reneo

2016-11-05 03:30:35

You can use AutoHotKey to map F1 to a new key..
https://autohotkey.com

IE script:
F1::
{
send {NumpadSub}
}
return
F2::
{
send {NumpadAdd}
}
return

;or you can eat the keystroke like below: This will still be visable to Bomes App
F1::Return

Cheers, Rene

florian

2016-11-07 23:10:55

Hi Rene, nice solution -- it actually removes keystrokes? that's a nice feat.
Wondering if we could implement that, too, then!
Thanks,
Florian

sjcaldwell

2016-11-08 00:34:02

Yes.
Autohotkey has lots of nice features. I even found a midi-io library written for it but I haven't had much time to play with it.
Unfortunately the development on it seems to have waned over the last few years so I imagine you won't see many new features or bug fixes. I use it to automate a lot of Windows type tasks, and yes, map keystrokes too in some cases.

bdumaguina

2016-11-16 16:12:10

reneo wrote:You can use AutoHotKey to map F1 to a new key..
https://autohotkey.com

IE script:
F1::
{
send {NumpadSub}
}
return
F2::
{
send {NumpadAdd}
}
return

;or you can eat the keystroke like below: This will still be visable to Bomes App
F1::Return

Cheers, Rene
Hello Reneo,

Is there a way to make this work ONLY in Ableton Live? Only when the window is active? I've used autohotkey before but my programming skills are only minimal. From my understanding, with this script; the keymapping will reflect on ALL programs.

Thanks,
Bryan

sjcaldwell

2016-11-16 17:36:04

Yes I believe Autohotkey has an Infocus function that will allow you to only map keys with a given application is in focus. I suggest you goto to autohotkey,com and look at some of the user contributed scripts.

bdumaguina

2016-11-16 17:42:22

Thank you sjcaldwell.

sjcaldwell

2016-11-16 18:00:53

Actually it is called IfWinActive

Here is an example from the help file

Code: Select all

IfWinActive, Untitled - Notepad
{
    WinMaximize  ; Maximizes the Notepad window found by IfWinActive above.
    Send, Some text.{Enter}
    return
}

if WinActive("ahk_class Notepad") or WinActive("ahk_class" . ClassName)  ; "ahk_class" need not have a space after it.
    WinClose  ; Uses the last found window.
Here is another using a directive maybe more appropriate for your situation

Code: Select all

#IfWinActive ahk_class Notepad
^!a::MsgBox You pressed Ctrl-Alt-A while Notepad is active.  ; This hotkey will have no effect if pressed in other windows (and it will "pass through").
#c::MsgBox You pressed Win-C while Notepad is active.
::btw::This replacement text for "btw" will occur only in Notepad.
#IfWinActive
#c::MsgBox You pressed Win-C in a window other than Notepad.

sjcaldwell

2016-11-16 18:17:40

Here is an example I wrote

If you are in Notepad and it is active it will send "Hello" on F1 and "There" on F2. Otherwise it behaves like default F1 and F2 key for Windows.

Code: Select all

;End Standard Code here
SetTitleMatchMode, 2
#ifWinActive , Notepad
F1::
{
send Hello
}
return
F2::
{
send There
}
return

bdumaguina

2016-11-16 18:37:43

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

SetTitleMatchMode, 2
#IfWinActive , ahk_exe , Ableton Live 9 Suite.exe
F1::
{
send {NumpadSub}
}
return
F2::
{
send {NumpadAdd}
}
return
#IfWinActive

It's not working. I must be missing something.

sjcaldwell

2016-11-16 19:08:59

You must use the title that shows in your Ableton live window title. I doubt if the full .exe is shown in your ablton live window.
Use just the minimum amount of characters to uniquely define the window title.

Code: Select all

SetTitleMatchMode


One of the following digits or the word RegEx:

1: A window's title must start with the specified WinTitle to be a match.
2: A window's title can contain WinTitle anywhere inside it to be a match. 
3: A window's title must exactly match WinTitle to be a match.

RegEx (v1.0.45+): Changes WinTitle, WinText, ExcludeTitle, and ExcludeText to be regular expressions. Do not enclose such expressions in quotes when using them with commands. For example: WinActivate Untitled.*Notepad. RegEx also applies to ahk_class; for example, ahk_class IEFrame searches for any window whose class name contains IEFrame anywhere (this is because by default, regular expressions find a match anywhere in the target string). Note: For WinText, each text element (i.e. each control's text) is matched against the RegEx separately. Therefore, it is not possible to have a match span more than one text element.

The modes above also affect ExcludeTitle in the same way as WinTitle. For example, mode 3 requires that a window's title exactly match ExcludeTitle for that window to be excluded.

This will likely work

Code: Select all

SetTitleMatchMode, 2
#IfWinActive , Ableton
F1::
{
send {NumpadSub}
}
return
F2::
{
send {NumpadAdd}
}
return
#IfWinActive

bdumaguina

2016-11-16 20:46:53

Thank you for this Sir.

[/quote]
This will likely work

Code: Select all

SetTitleMatchMode, 2
#IfWinActive , Ableton
F1::
{
send {NumpadSub}
}
return
F2::
{
send {NumpadAdd}
}
return
#IfWinActive
[/quote]

I also got it to work with this script.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#IfWinActive ahk_exe Ableton Live 9 Suite.exe 

{

	F1::NumpadSub

	F2::NumpadAdd

}

#IfWinActive