Live 8/9 Autosave app using applescipt, + general shortcuts

Discussion of music production, audio, equipment and any related topics, either with or without Ableton Live
Post Reply
moonpie
Posts: 305
Joined: Mon Aug 30, 2010 11:22 am

Live 8/9 Autosave app using applescipt, + general shortcuts

Post by moonpie » Sun May 18, 2014 6:56 pm

So I hotkeyed some features in Ableton I think help the longevity of Live 8 and hugely helped the speed of my workflow. I also made an autosave application for Live if anyone is interested. Im sure itll work on Live 9 as well with a little noodling. Not the most graceful of hacks, but for what it is I think it achieved a good bit. A big thank you to cooper12 on reddit for help getting there and helping me format things correctly! Just thought Id pass on the help to other people.

Unfortunately I did this stuff on osx, BUT Im sure a similar thing can be achieved on windows with autohotkey and a script program following the same principles.


The 1st thing was enabling hotkeys for a couple valuable features - freeze, show/hide midi clip, insert/delete locator, show/hide midi note and 'save as copy'. (save as copy is important for autosave). Without the hotkeys (which abes didnt give :/ ) I felt like these features were really cumbersome, and not as used as they shouldve been. After trying it out initially, it seemed to be very inconsistent, which most old posts pointed out. I stumbled across a single old post on this forum after many nights of searching, (unfortunately I cant find the post - but credit where its due - it wasnt my idea. Think abes support helped out too.) which basically showed the correct way to enable hotkeys for the functions in ableton.

Basically, for these functions, you have to have a hotkey for every version of that functions name. So freeze, and unfreeze all have to be mapped separately to the same key. It was only mapping one of these that caused and inconsistency. Also - some hotkey arrangements seem safer/more consistent than others - so 'cmd + ctrl + key' worked the best. (on windows you'll have to just experiment).

Heres the list you can enter in sys prefs/keyboard/application shortcuts -

Deactivate/Activate Ctrl+Cmd+m
Deactivate Note(s) Ctrl+Cmd+m
Activate Note(s) Ctrl+Cmd+m
Deactivate/Activate Clip(s) Ctrl+Cmd+m
Activate Clip(s) Ctrl+Cmd+m
Deactivate Clip(s) Ctrl+Cmd+m
Freeze Track Ctrl+Cmd+f
Unfreeze Track Ctrl+Cm+f
Save a Copy... Ctrl+Cmd+s (Needed for autosave)
Add Locator Ctrl+Cmd+k
Delete Locator Ctrl+Cmd+k
Insert Locator Ctrl+Cmd+k


Now AUTOSAVE - I created a simple application in applescript which basically works the following way -

1) go to system prefs/accessibility and tick 'enable access for assisted devices'. (think accessibility is under 'universal access' on some osx versions.)

2) Open up applescript editor (just search in spotlight)

3) Paste the script below in applescript. (copy paste everything in white)

4) Click Save. It will ask you where your Live is located, just point it to Live in the applications folder.

5) Save file format as an application. Tick 'Stay open after run handler'. Leave show startup screen unticked.

6) Close applescipt.

7) Open up ableton. Create a new project and save it. Really important you save first before autosave is activated as otherwise itll save autosaves in the wrong folder.

8) Activate the app

9) Youll get a dialog saying "Autosave Activated'. Also it should almost immediately save a version of your project on run. (You can obviously test/debug quicker by using a shorter delay. So putting in 20secs instead of the default 180 for example)

The app works using simple text commands. Every 3mins (you can change the frequency in the code easily, its listed as 180 seconds) it will -
bring ableton to the foreground,
click 'cmd+ctrl+s'
delete the word 'copy' from the 'save a copy' name dialog
insert the date and time
click enter

And presto, youll have separate backup files named in your project folder. This has the added benefit of saving your project WITHOUT deleting your undo history. Which is pretty nifty. It does this pretty quickly/seemlessly. Its good enough for me anyways!

You are free to edit the autosave frequency - just change 'return 180' (its in seconds) to 'return 300' for 5mins etc.

Just paste the following -

Code: Select all

-- Here you can specify anything that needs to be done on startup
on run
	tell application "Ableton Live 8 32bit"
		activate
		display alert "Autosave Activated"
	end tell
	
end run

-- this is the main loop of the program. it runs every 180 seconds.
on idle
	
	tell application "Ableton Live 8 32bit"
		activate
		tell application "System Events"
			tell process "Ableton Live" to keystroke "s" using {control down, command down}
			key code 124
			key code 51
			key code 51
			key code 51
			key code 51
			key code 51
			keystroke space
			keystroke (current date) as string
			keystroke space
			keystroke "autosave"
			delay 0.1
			keystroke return
		end tell
	end tell
	
	
	-- Ask the system to call again in 180 seconds time.
	return 180
end idle

-- here you can tell the program what to do when you quit, such as cleaning up.
on quit
	tell application "Ableton Live 8 32bit"
		activate
		
		display alert "Autosave Deactivated"
	end tell
	continue quit
end quit

If people would like me to upload the app I can, but honestly just open applescript, paste this in, and youll save yourself the hassle of having to edit it manually anyways.

EDIT: Forgot the step - go to system prefs/accessibility and tick 'enable access for assisted devices'. Added it to the steps.
Last edited by moonpie on Wed May 21, 2014 4:30 pm, edited 7 times in total.

jestermgee
Posts: 3696
Joined: Mon Apr 26, 2010 6:38 am
Contact:

Re: Hints for Live 8 longevity - feature shortcuts and autosave!

Post by jestermgee » Sun May 18, 2014 11:47 pm

Thanks for the efforts.

In regards to the "Auto Save" wouldn't that create issues if you were editing/using live and every 3 minutes you had the save dialogue open and do its thing?

On Windows for instance you could use Autohotkeys or AutoITv3 easily enough. I prefer Bomes MIDI Translator because it allows the same things to be done but also to be set to a MIDI controller as well so no need to remember key combos, just press a button.

I'm sure some of the functions you have listed have key combos already.

moonpie
Posts: 305
Joined: Mon Aug 30, 2010 11:22 am

Re: Hints for Live 8 longevity - feature shortcuts and autosave!

Post by moonpie » Mon May 19, 2014 12:24 am

No, everything Ive listed doesnt have a key combo by default in Live 8 with noway to assign it internally. Not sure of situation on windows but imagine the same. Usually support will recommend paid for hotkey programs for osx or as I also listed for windows - autohotkey for free. For osx, the system wide application shortcut possibility was patchy for users, for the reasons above.

For workflow reasons, midi for editing reasons can be overkill, and as far as I know the functions Ive listed cant be easily assigned to midi. I also use kimidi http://stc.wiffbi.com/midi-implementation-chart/ and even though that provides a huge amount of function, it lacks these. These are immensely helpful functions to be able to use quickly, and they are standard in every daw, its just ableton maybe chickened out implementing them fully in Live 8 to have extra functions in Live 9. (I think everything has a hotkey in 9)

The thing with the automated script is that it is extremely quick. <1sec saving. Faster than a human can do it. A quick flash of a text box. This doesnt interrupt your workflow (which is important) in my experience. You can lessen it of course to whatever time you like. Every 5mins or so for a 500ms dialog box is well worth it. There are drawbacks I would have loved to figure out, such as an auto cleanup of the project folder to the last 10 autosaves or somesuch, but thats far outside my ability. Assigning it to every 3 minutes will result in 20 autosaves an hour. So you probably will open up the project folder now and again and do a little housekeeping.

Aside from that - a huge functionality improvement is keeping the undo history of your entire project. You have background autosaves, which leaves the curent project untouched, and a fully functional undo history to work with. That for me is a big deal. Adding alot of security to a project.

The initial reason for doing this was sound design within a vst/au was a risky task. Live 8 doesnt retain any of the vst/au information at the point of a crash. And although this is infrequent, it is still extremely frustrating to lose any intricate work youve been doing in a plugin. If you save, you are losing the sound you had 5mins ago. And that can have knockon effects in other parts of your project youre not focusing on at the time. This is a great way to add security to sound design.

You dont have to turn it on for every project, just when youre doing intensive stuff that requires this security.

3dot...
Posts: 9996
Joined: Tue Feb 20, 2007 11:10 pm

Re: Hints for Live 8 longevity - feature shortcuts and autosave!

Post by 3dot... » Mon May 19, 2014 10:05 am

this is very handy... thanks

so in order for this to work with L9..
all i have to do is change the name of the app where it applies... and change to my preferred timing?

is it possible to also trigger 'collect all and save' after the auto-save?
Image

3dot...
Posts: 9996
Joined: Tue Feb 20, 2007 11:10 pm

Re: Hints for Live 8 longevity - feature shortcuts and autosave!

Post by 3dot... » Mon May 19, 2014 10:17 am

also need to change the process from "Ableton Live" to "Live"
Image

3dot...
Posts: 9996
Joined: Tue Feb 20, 2007 11:10 pm

Re: Hints for Live 8 longevity - feature shortcuts and autosave!

Post by 3dot... » Mon May 19, 2014 10:36 am

and also it still doesn't work... autosave activated comes up.. but no actual saves are performed
Image

moonpie
Posts: 305
Joined: Mon Aug 30, 2010 11:22 am

Re: Hints for Live 8 longevity - feature shortcuts and autosave!

Post by moonpie » Mon May 19, 2014 2:03 pm

EDIT: AHA, this could be the real problem, try this first - go to system prefs/accessibility and tick 'enable access for assisted devices'. I had forgotten I had enabled this when I first started using applescript. This allows applescript to communicate to 'system events' Ill put it in post one.

Did you make sure to do the cmd+ctrl+s shortcut part? That's extremely important. It has to be that shortcut, and it has to be named exactly 'Save a Copy...'


I assume since you got the dialog 'Autosave activated' that its correctly identified the Live application folder. It displayed a finder dialog to point to it, as it did on mine? 'Autosave is activated' should appear as a nice 'ableton' alert box, which is a good sign at least it knows which application you mean.

Thats interesting with the process name. Are you sure? Just to clarify from my understanding/own discovery - the 'process name' isnt the process name in activity monitor. The process name IS Live in activity monitor as well on my computer for Live 8. The actual 'process' or whatever applescript uses to identify or name it is 'Ableton Live', and I dont see why that would change for Live 9. But you might know. Im not sure exactly how it judges process name, but I know it isnt through activity monitor (although they may coincidentally be the same).


If you get that working, and Ill try help you out if you cant, since Id like people to be able to use it - your 2nd question on collect all and save:
The problem with this is it saves the current project to the current open project. Which will essentially kill the reason of autosave. Autosaving using the 'normal' saving route, (i.e. not 'save a copy') would be risky, as every 3/5mins your project would be saved, wiping your undo history. Which could have really crap consequences when you find out your undo history is gone.

You could easily set up a script that has a separate timer for 'collect all and save' every 30mins or so - but again, at the wrong moment this could have bad consequences resulting in losing some important info. I could very quickly write this script out for you, but I dont think it would have the effect youd want.

In applescript - make sure to save the 'file format' as an application, and tick 'stay open after run hander'. You can leave show startup screen as unticked.

This is all working for me on osx 10.8.5 and Live 8.4.2.
Last edited by moonpie on Mon May 19, 2014 2:40 pm, edited 1 time in total.

moonpie
Posts: 305
Joined: Mon Aug 30, 2010 11:22 am

Re: Hints for Live 8 longevity - feature shortcuts and autosave!

Post by moonpie » Mon May 19, 2014 2:25 pm

I updated the steps in more detail. And if we figure out how it works on Live 9, Ill include those steps as well.

moonpie
Posts: 305
Joined: Mon Aug 30, 2010 11:22 am

Re: Hints for Live 8 longevity - feature shortcuts and autosave!

Post by moonpie » Mon May 19, 2014 2:28 pm

3dot... wrote:and also it still doesn't work... autosave activated comes up.. but no actual saves are performed
Also 3dot - I forgot - does 'Save a Copy...' have a default hotkey in Live 9? If it does, then you can skip the 'control+cmd+s' part and can modify the hotkey in the script to the hotkey in Live. Id do this for you if you could tell me the key combo.

If we get it working on Live 9, Ill paste a separate script with edits to help people.

3dot...
Posts: 9996
Joined: Tue Feb 20, 2007 11:10 pm

Re: Hints for Live 8 longevity - feature shortcuts and autosave!

Post by 3dot... » Mon May 19, 2014 2:32 pm

It's command shift s...
Image

moonpie
Posts: 305
Joined: Mon Aug 30, 2010 11:22 am

Re: Hints for Live 8 longevity - feature shortcuts and autosave!

Post by moonpie » Mon May 19, 2014 2:43 pm

3dot... wrote:It's command shift s...
Is command shift s not still "Save Live Set As"? Or did they change it? 'Save a Copy...' is the one we need.

3dot...
Posts: 9996
Joined: Tue Feb 20, 2007 11:10 pm

Re: Hints for Live 8 longevity - feature shortcuts and autosave!

Post by 3dot... » Mon May 19, 2014 2:49 pm

Sorry my bad... I'll play with it some more
Image

moonpie
Posts: 305
Joined: Mon Aug 30, 2010 11:22 am

Live 8/9 Autosave app using applescipt, and general shortcut

Post by moonpie » Wed May 21, 2014 3:44 pm

Bump. Be interested getting it working fully for Live 9 if anybody wants to try it out.

3dot...
Posts: 9996
Joined: Tue Feb 20, 2007 11:10 pm

Re: Live 8/9 Autosave app using applescipt, + general shortcuts

Post by 3dot... » Wed May 21, 2014 5:35 pm

couldn't get it to work with L9...
Image

Post Reply