AutoHotkey and Live 9

Discussion of music production, audio, equipment and any related topics, either with or without Ableton Live
Post Reply
sporkles
Posts: 3188
Joined: Sun Feb 18, 2007 8:43 pm
Location: Schmocation

AutoHotkey and Live 9

Post by sporkles » Sun Mar 17, 2013 6:04 pm

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?

metastatik
Posts: 318
Joined: Tue Mar 13, 2007 3:28 pm

Re: AutoHotkey and Live 9

Post by metastatik » Sun Mar 17, 2013 6:24 pm

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.

sporkles
Posts: 3188
Joined: Sun Feb 18, 2007 8:43 pm
Location: Schmocation

Re: AutoHotkey and Live 9

Post by sporkles » Sun Mar 17, 2013 7:32 pm

Cool! Did I tell you already that you rock? :D

Thanks!

sach160
Posts: 79
Joined: Thu Oct 01, 2009 4:26 pm

Re: AutoHotkey and Live 9

Post by sach160 » Thu Mar 21, 2013 11:07 am

Metastatik, thanks for this tip, works a treat!

sporkles
Posts: 3188
Joined: Sun Feb 18, 2007 8:43 pm
Location: Schmocation

Re: AutoHotkey and Live 9

Post by sporkles » Sat Nov 02, 2013 2:21 pm

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.

metastatik
Posts: 318
Joined: Tue Mar 13, 2007 3:28 pm

Re: AutoHotkey and Live 9

Post by metastatik » Sat Nov 02, 2013 3:55 pm

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.

Post Reply