AutoHotkey and Live 9
AutoHotkey and Live 9
Using Window Spy, it seems that the ID of Live's window changes between each launch, making it impossible to make shortcuts exclusive to Live. Does anyone have a solution?
-
- Posts: 318
- Joined: Tue Mar 13, 2007 3:28 pm
Re: AutoHotkey and Live 9
Yes, use the RegEx match mode and then you can just specify part of Live's window class (the part that doesn't change). For example, put this at the top of your script(s):
Then, when using window-based actions, just specify ahk_group LiveWin for the window title.
This will work with any version of Live.
Code: Select all
SetTitleMatchMode, RegEx
; Class of Live's 32-bit and 64-bit windows
GroupAdd, LiveWin, ahk_class Afx:00400000:0:00000000:01900015:
GroupAdd, LiveWin, ahk_class Afx:0000000000400000:0:0000000000000000:0000000001900015:
This will work with any version of Live.
Site: http://www.nativekontrol.com
Facebook: https://www.facebook.com/nativeKONTROL/
YouTube: https://www.youtube.com/user/Stray411
Facebook: https://www.facebook.com/nativeKONTROL/
YouTube: https://www.youtube.com/user/Stray411
Re: AutoHotkey and Live 9
Cool! Did I tell you already that you rock?
Thanks!
Thanks!
Re: AutoHotkey and Live 9
Metastatik, thanks for this tip, works a treat!
Re: AutoHotkey and Live 9
OK, new challenge: how to get the script to do the same thing when a) a plugin window is active ("ahk_class AbletonVstPlugClass") and b) when Live 9.1's second window is active ("ahk_class Afx:00000000004000000000000000010005:0000000001900015:0000000000E00171") as when the main Live window is active?
At the moment, I can't seem to get this to work.
At the moment, I can't seem to get this to work.
-
- Posts: 318
- Joined: Tue Mar 13, 2007 3:28 pm
Re: AutoHotkey and Live 9
That would sort of depend on what the script is doing.
AHK can send commands (check out ControlSend and WinMenuSelectItem for examples) to specific windows regardless of which window is active. So updating the script to do that might be your best bet. You can, of course, also activate a window prior to sending a command via WinActivate.
Alternatively/additionally, if you need to be able to disable hotkeys when Live and any of its sub-windows are inactive/don’t exist, you may be better off using a timer to check whether the windows are active/present and using Suspend to disable/enable your hotkeys accordingly. In this case, you may want to create two windows groups; one for all of Live’s windows/sub-windows and one just for the Live windows you want your commands to target.
AHK can send commands (check out ControlSend and WinMenuSelectItem for examples) to specific windows regardless of which window is active. So updating the script to do that might be your best bet. You can, of course, also activate a window prior to sending a command via WinActivate.
Alternatively/additionally, if you need to be able to disable hotkeys when Live and any of its sub-windows are inactive/don’t exist, you may be better off using a timer to check whether the windows are active/present and using Suspend to disable/enable your hotkeys accordingly. In this case, you may want to create two windows groups; one for all of Live’s windows/sub-windows and one just for the Live windows you want your commands to target.
Site: http://www.nativekontrol.com
Facebook: https://www.facebook.com/nativeKONTROL/
YouTube: https://www.youtube.com/user/Stray411
Facebook: https://www.facebook.com/nativeKONTROL/
YouTube: https://www.youtube.com/user/Stray411