The Definitive Live Autohotkeys script!

Discussion of music production, audio, equipment and any related topics, either with or without Ableton Live
Patch
Posts: 2614
Joined: Sun Aug 15, 2004 8:14 pm
Location: Bristol, UK

Post by Patch » Thu Feb 08, 2007 9:09 am

Grand job all you AHK ninjas are doing here!!! I'll (hopefully!) be joining y'all soon - once I've managed to master the dark art of AHK..!

Another question:

Can you utilise keydown/keyup for keystrokes? The reason I ask is that I would like to create navigation that works like this:

Use arrow keys to select slot to load to
HOLD DOWN CTRL (or another modifier) to change focus to browser
With CTRL held down, use arrow keys to select track to poulate selected slot
Release CTRL, slot is populated

I'm pretty sure (from my LIMITED knowledge of AHK) that this is possible. But am I right in saying that we will need to map multiple keystrokes to the CTRL key? (ie - keydown will execute keystroke "x", and keyup will execute keystroke "y"...)

rozling
Posts: 1759
Joined: Mon May 30, 2005 9:48 am
Location: Dublin, Ireland

Post by rozling » Thu Feb 08, 2007 10:33 am

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!

stutter
Posts: 488
Joined: Tue Sep 05, 2006 3:58 pm

Post by stutter » Thu Feb 08, 2007 2:34 pm

good work Rozling. That kaykit util looks rather useful. I'm hopefully (assuming I get no more powercuts today) going to sort mine out today. I think there's probablt some way that the browser/cli p loading thing can be done without mousecliks, so that screen resolution is no longer a problem. Colour probably still will be though. I'm doing everything with the default skin.
Matt

nebulae
Posts: 15707
Joined: Tue Sep 07, 2004 12:16 am
Location: New Orleans
Contact:

Post by nebulae » Thu Feb 08, 2007 4:51 pm

hoffman2k wrote:On a side note:

People who want to do this on mac don't need a script.

Juts go to system preferences < keyboard & mouse < key combo's

You can edit everything that is available in the Live menubar.
are you able to get mouse scroll zooming working in OSX?
Image Image Image Image

nebulae
Posts: 15707
Joined: Tue Sep 07, 2004 12:16 am
Location: New Orleans
Contact:

Post by nebulae » Thu Feb 08, 2007 5:02 pm

Given this very long discussion, it might be helpful to have a ReadMe file along with the script that tells all the major functionality. I'm sure the script is properly commented, but an overview of features (in order of appearance in the script) would be really helpful. That way, we can pick and choose. Just a suggestion.
Image Image Image Image

rozling
Posts: 1759
Joined: Mon May 30, 2005 9:48 am
Location: Dublin, Ireland

Post by rozling » Thu Feb 08, 2007 5:39 pm

Quite true, I've just discovered how to use/abuse AHK's A_WorkingDir variable which overcomes a hurdle I had in doing that. I will soon be uploading .zips with the required files (including the clip brace start ones, FWIW) contained.

To all you AHK users out there, my hope would be to create a GUI which has a big list of key commands on one side and a big list of actions on the other. Each key command would have a text box and each action would have a drop-down list to select from. I have no clue how to do this at the moment (quickly and easily that is) so any ideas would be greatly appreciated.

If it's of any relevance, my plan is to include all potential keyboard shortcuts (even ones native to Live) in some kind of big list within the script - maybe some kind of data table? - to make them accessible via the GUI.

stutter
Posts: 488
Joined: Tue Sep 05, 2006 3:58 pm

Post by stutter » Thu Feb 08, 2007 6:18 pm

Rozling - the ctrl-c, ctrl-v method of loading still works:
- select clip slot
- set focus on browser
- select clip to load, ctrl-c
- return focus to clip slot, ctrl-v

That avoids resolution and skin problems.

rozling
Posts: 1759
Joined: Mon May 30, 2005 9:48 am
Location: Dublin, Ireland

Post by rozling » Thu Feb 08, 2007 6:22 pm

Nice one - wonder why I couldn't get it working on my machine... I may not get back to this script for a couple of days - will see about reverting to key commands then, or if anyone feels like doing it so I can work on other functions, be my guest! It'd be a good beginner's script...

stutter
Posts: 488
Joined: Tue Sep 05, 2006 3:58 pm

Post by stutter » Thu Feb 08, 2007 6:26 pm

fits with my focus stuff, so I'll stick it in there - should have some version of my script sorted today, so I'll upload it and explain it on here.

rozling
Posts: 1759
Joined: Mon May 30, 2005 9:48 am
Location: Dublin, Ireland

Post by rozling » Thu Feb 08, 2007 6:34 pm

Savage!
nebulae wrote:...it might be helpful to have a ReadMe file...
I've been finding a lot of seriously useful tools for AHK writers/builders/users. I may have found a GUI for an .ini fie settings editor too (if I actually understand what I'm looking at that is). All this should encourage more fuckery with AHK.

edit: oh yeah, and the point is I would hope to include these in the Readme as well. Kinda give a broader understanding of the thing. Anyway I'm off for a while...

stutter
Posts: 488
Joined: Tue Sep 05, 2006 3:58 pm

Post by stutter » Thu Feb 08, 2007 10:21 pm

So here's mine, or at least the parts of it that could be relevant for other people:

get it here:
http://www.mediamax.com/stutter/Hosted/ ... script.rar

there's an htm readme in there which explains the key bindings and their uses, these are also commented within the script. Please use the folder structure that the rar has, although you can change the name and location of the folder which you unrar. There are quite a lot of little screenshot-made icon's in there, only a few of which are used in the script. They are of the Default skin, Live v.6. A couple of the commands rely on cursor/screen co-ordinates, in which case they might not work on computers running at different resolution. Mine's 1280 x 1024. I tried to keep this to a minimum and have commented on which parts it affects in the script. Most functions should work for everybody (if you use the same skin, or are willing to make some little icons of your own).


Anyone wondering what functions this script has, here's the readme:

SETTING FOCUS



Numpad keys used - as the key-names indicate, these are the bottom 5 numpad keys when Numlock is off - this should allow the numpad to still be used to enter numbers



Numpad Insert (0) - Set focus on Clip details

Numpad Delete (.) - Set focus on Browser

Numpad End (1) - Set focus on Clip Slot

Numpad Down (2) - Set focus on Track Title

Numpad PageDown (3) - Set focus on ...ermm, well not sure whether Overview or Track In/Out

NumpadIns & Left/Right cursor - moves to clip detail of track on left or right - for use with midi controllers



I left the old code in there. The new part is now compatible with clip brace - thus works as normal when clip brace is unselected, using Alt and cursor key combinations to set focus; when clip brace is selected the keys first de-select it, otherwise you have your loop jumping about - keys always check this before moving focus.



NAVIGATING BROWSER



Again, uses numpad keys when NumLock is off



NumpadLeft (4) - Select first item in Live Device browser

NumpadClear (5) - Select first item in Plug-in browser

NumpadRight (6) - Select first item in Sample QuickSwap browser

NumpadHome (7) - Select first item in Folder1 browser

NumpadUp (8) - Select first item in Folder2 browser

NumpadPgUp (9) - Select first item in Folder3 browser



each of these "first item" does not jump to top of list, but remembers scroll in list and goes to top item that way (as is default in Live) - this could be altered with the scroll bar, which might allow for binding keys to favourite folders.



NumpadDel & NumpadEnter in combination - drop selected browser item into selected clip slot. Just press enter to load vsts into current track



EDITING



End - undo

PgDn - redo

Insert - cut

Home - copy

PgUp - paste



NumpadMultiply - follow

NumpadDivide - draw mode



QUANTISE



] - Global Quantise off

[ - Global Quantise to 1 beat

# - Global Quantise to 1 bar

' - Global Quantise to 8 bars - this part might not work with different screen resolutions.

Ctrl (or) Right Shift (and) ] - Snap to grid toggle

Ctrl (or) Right Shift (and) [ - triplet grid toggle

Ctrl (or) Right Shift (and) # - widen grid

Ctrl (or) Right Shift (and) ' - narrow grid



LOOPBRACE



Right Control - select clip brace for loop fuckery

This relies on imagesearch to find the beginning of the brace - if loop length it set low enough, so that start and end markers on the brace overlap, it will not be able to do so. In this case loop length needs lengthening – use Appskey (see below)

… likewise, if clip is sufficiently zoomed in, and brace start cannot be seen, this will not work - if so, zoom out.



LOOPING



Appskey (the one on the right, looks like a right-click menu) - sets loop to 16 bars at cursor position

- loop length editable at Loopstep3 in the script, in reverse order (i.e. 3 boxes from right to left)

… chose 16 bars as this gives time to change, is common to electronic arrangement, and can easily be shortened with cursor keys

- After pressing Appskey, cursor left and right should select the loop length boxes, allowing you to re-type the length



TOGGLE LOOP

Right shift - Toggle Loop



Also appended Ilia’s mousewheel zoom to the end of the script, since that seemed useful, although I haven’t tested that yet

rozling
Posts: 1759
Joined: Mon May 30, 2005 9:48 am
Location: Dublin, Ireland

Post by rozling » Fri Feb 09, 2007 1:34 pm

stutter wrote: QUANTISE
] - Global Quantise off
[ - Global Quantise to 1 beat
# - Global Quantise to 1 bar
' - Global Quantise to 8 bars - this part might not work with different screen resolutions.

Ctrl (or) Right Shift (and) ] - Snap to grid toggle
Ctrl (or) Right Shift (and) [ - triplet grid toggle
Ctrl (or) Right Shift (and) # - widen grid
Ctrl (or) Right Shift (and) ' - narrow grid
stutter wrote:LOOPBRACE
Right Control - select clip brace for loop fuckery

This relies on imagesearch to find the beginning of the brace - if loop length it set low enough, so that start and end markers on the brace overlap, it will not be able to do so. In this case loop length needs lengthening – use Appskey (see below)

… likewise, if clip is sufficiently zoomed in, and brace start cannot be seen, this will not work - if so, zoom out.
stutter wrote:LOOPING
Appskey (the one on the right, looks like a right-click menu) - sets loop to 16 bars at cursor position

- loop length editable at Loopstep3 in the script, in reverse order (i.e. 3 boxes from right to left)

… chose 16 bars as this gives time to change, is common to electronic arrangement, and can easily be shortened with cursor keys

- After pressing Appskey, cursor left and right should select the loop length boxes, allowing you to re-type the length
I particularly like these bits - Loop brace especially should interest a few here!
stutter wrote:fuckery
What a word.

Looking forward to dissecting the script - can't see myself getting much more done scripting-wise this weekend. However later today I'll try & put together some decent scripting resources I've found.

Patch
Posts: 2614
Joined: Sun Aug 15, 2004 8:14 pm
Location: Bristol, UK

Post by Patch » Fri Feb 09, 2007 1:49 pm

Like I've said before in this thread - I WILL get around to learning AHK! But for the time being I'm really happy that the guys in this thread are doing so much!

Cheers - AHK fans - I salute you!

stutter
Posts: 488
Joined: Tue Sep 05, 2006 3:58 pm

Post by stutter » Fri Feb 09, 2007 2:24 pm

it occured to me that some of the functions maybe won't work if you have the tip box open. Also screen res and skin will affect functionality. If you have any of these problems just ask in this thread and I'll get back to you.

rozling
Posts: 1759
Joined: Mon May 30, 2005 9:48 am
Location: Dublin, Ireland

Post by rozling » Sun Feb 11, 2007 4:30 pm

Had a long songwriting session using Live yesterday (14 hours 8O ) and have had a chance to use the 'big' script a lot. One thing I realised is the necessity for the script to pause while renaming/searching or editing values (if the number keys are mapped). Edit: after posting for help realised how to do this (wasn't implementing keywait properly)

Code: Select all

^r:: 
  Suspend , on 
  Send ^r 
  Keywait Return , d
  Suspend , off
  return
BTW I'm now using the freeware PSPad to edit my scripts and am finding it much easier than using Notepad. There's a lot to get your head around (not least setting it up to use with AHK) but if anyone's interested in using it I can give you a few pointers to get started.

The main advantages are you get:
- Tabs so you can have several scripts open in the same window, which you can view side by side or do automatic comparisons.
- Projects - You can organise all files related to a project in shortcut folders regardless of their actual location (including files on FTP servers so you can edit your online version directly).
- Bookmark locations in a script and jump to them using Alt+Arrows
- It's easier to do stuff like comment out an entire block of text with a single key command (Ctrl+Shift+a).
- F9 runs your file from within PSPad
- Coloured text to distinguish between comments/commands etc

There's also a script in the AHK installation folder under Extras called Intellisense which watches what you type, and when you type an AHK command it gives you a tooltip with the paramaters for the command. Then pressing F1 jumps to the AHK help item for that command - a lifesaver for the likes of me who spends my life in the Help!

Post Reply