Page 1 of 1

AutoHotkey and Live 9

Posted: Sun Mar 17, 2013 6:04 pm
by sporkles
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?

Re: AutoHotkey and Live 9

Posted: Sun Mar 17, 2013 6:24 pm
by metastatik
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):

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:
Then, when using window-based actions, just specify ahk_group LiveWin for the window title.

This will work with any version of Live.

Re: AutoHotkey and Live 9

Posted: Sun Mar 17, 2013 7:32 pm
by sporkles
Cool! Did I tell you already that you rock? :D


Re: AutoHotkey and Live 9

Posted: Thu Mar 21, 2013 11:07 am
by sach160
Metastatik, thanks for this tip, works a treat!

Re: AutoHotkey and Live 9

Posted: Sat Nov 02, 2013 2:21 pm
by sporkles
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:0000000000400000:b:0000000000010005:0000000001900015:0000000000E00171") as when the main Live window is active?

At the moment, I can't seem to get this to work.

Re: AutoHotkey and Live 9

Posted: Sat Nov 02, 2013 3:55 pm
by metastatik
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.