The Definitive Live Autohotkeys script!

Discussion of music production, audio, equipment and any related topics, either with or without Ableton Live
djsynchro
Posts: 7471
Joined: Thu Jun 23, 2005 9:06 pm
Location: Amsterdam, Netherlands
Contact:

Post by djsynchro » Thu May 08, 2008 12:03 am

http://www.ableton.com/forum/viewtopic.php?t=91075

Script to open all plugin Windows, mainly for those with dual monitors, one screen with live, one with plugs, set to "autohide" when you select a track the tracks plugs show on the 2nd screen, nice!

BUTTTTT!!!!! Live close all the VST windows when you first open a saved set. Now you've got to go and manually open 100 windows with the mouse!
So now the script does that for you.

.AHK files with lots of comments in the code, feel free to change/adapt/print out on paper feed to your dog... whatever.

flipotto
Posts: 141
Joined: Mon Oct 23, 2006 4:28 pm
Location: Virginia

Re:

Post by flipotto » Sun Oct 25, 2009 7:58 pm

rozling wrote:Pulling this off with one key is definitely the next logical step, though I haven't quite got my head around alternating between different sets of actions with a single keystroke.

To answer directly: yes you can - multiple keystrokes are quite easy to do in AHK, e.g. in one part of the script I've done the following for View I/O as my laptop has issues understanding the standard Ctrl+Alt+i:

Code: Select all

i::
{
Send {RCtrl Down}{RAlt Down}{i}{Ralt Up}
	Sleep 50
Send {RAlt Down}{i}{Ralt Up}{RCtrl Up}
}
return
The problem is I'm not sure how to make it so that the first press does the above but the second press does something like

Code: Select all

i::
{
MouseClickDrag, left, MixerBarX, MixerBarY, TopOfLiveWindowX, TopOfLiveWindowY
}
return
which would maximise the mixer view for detailed metering (once it knows where the top of the Mixer Bar and the top of Live's window are).

Actually I hadn't considered what you say in the last line of your post - let me think about that one. Incidentally posting the above code has solved a problem I was having in the script - thanks!

Hey - I have made some successful progress with stacked commands on 1 key.
I still can't find your script, please, post it in code brackets!

drb
Posts: 302
Joined: Thu Mar 02, 2006 9:09 pm

Re: The Definitive Live Autohotkeys script!

Post by drb » Sun Oct 25, 2009 10:34 pm

This semi pseudo code runs a diff path based on which way the variable "window" is set so it toggles back and forth and running two alternating code blocks from hitting the f9 key.

Code: Select all

f9::
if window = closed                            
	{
        do some things 
        open the window                             ;open window
	window = open                               ;update window status variable
	return
	}
else						
	{
        do some things 
        close the window                            ;close window
	window = closed                             ;update window status variable
	}
return

flipotto
Posts: 141
Joined: Mon Oct 23, 2006 4:28 pm
Location: Virginia

Re: The Definitive Live Autohotkeys script!

Post by flipotto » Tue Nov 03, 2009 1:13 pm

drb wrote:This semi pseudo code runs a diff path based on which way the variable "window" is set so it toggles back and forth and running two alternating code blocks from hitting the f9 key.

Code: Select all

f9::
if window = closed                            
	{
        do some things 
        open the window                             ;open window
	window = open                               ;update window status variable
	return
	}
else						
	{
        do some things 
        close the window                            ;close window
	window = closed                             ;update window status variable
	}
return
Ok - I think I get that - here is some code from a thread on ahk forum, that I used to get 3 functions
on one key.

Try this one, just press the F1 key once, then twice, then three times.
Autohotkey script.

Code: Select all

F1::CountPresses("Once","Twice","Three") ; 

Once:        ; Send hotkey for original function
   MsgBox, 0, , You pressed 1 time, .75
   Return

Twice:
   MsgBox, 0, , You pressed 2 times, .75
   Return

Three:
   MsgBox, 0, , You pressed 3 times, .75
   Return

CountPresses(param1, param2, param3) {
   Global
   pressed1 := param1, pressed2 := param2, pressed3 := param3
   PressCount += 1
   SetTimer WaitKeyPress, 400 ; Restart waiting for more presses
}

WaitKeyPress:
   SetTimer WaitKeyPress, off ; run timer only once
   GoSub % PressCount < 3 ? pressed%PressCount% : pressed3
   PressCount := 0
Return

drb
Posts: 302
Joined: Thu Mar 02, 2006 9:09 pm

Re: The Definitive Live Autohotkeys script!

Post by drb » Tue Nov 03, 2009 5:39 pm

The second example is so you can have a function that does one thing if you press a key once, and then another if you press it twice.

The code I showed above is a toggle, so first the key does once thing, and next time it does something else. Like muting a track, and then unmuting next time you hit the same key.

flipotto
Posts: 141
Joined: Mon Oct 23, 2006 4:28 pm
Location: Virginia

Re: The Definitive Live Autohotkeys script!

Post by flipotto » Tue Nov 03, 2009 5:59 pm

drb wrote:The second example is so you can have a function that does one thing if you press a key once, and then another if you press it twice.

The code I showed above is a toggle, so first the key does once thing, and next time it does something else. Like muting a track, and then unmuting next time you hit the same key.
Got it, that is very useful, I can see that for a number of things.

Post Reply