Counter is a nice app to trigger MIDI sequences.
However, I suggest you don't use it; it sorta breaks the mouse.
One of few officially supported scripting languages for any DAW is Max for Live, for Ableton Live. It's a pity, then, that it's awful. There is an alternative semi-supported “back door” via LiveOSC. Ins and outs of both will be discussed here, plus the third option, the handmade backdoor of Gibberwocky.
Also, you could instead use a non-mainstream DAW. These often have scripting languages as their selling point. Notably, the audio production environment Renoise has embedded scripting using the respectable scripting language lua, although Renoise itself is a freaky non-mainstream sort of tool. csound also comes with some hybrid DAW/IDE options. There are probably other hacks available to the bloody-minded. See audio software.
If you care about nothing but tempo you can use the open Ableton Link to synchronise arbitrary things and skip the friction points.
Build your own plugins
OK, you have some weird thing you want to do with audio processing. There are many audio frameworks/languages that do this, such as csound, faust, Juce/c++, and so on. These lack the ability to control Ableton - they don't know anything about their host environment. Even, e.g. synchronizing with the host can be fiddly.
So, let's say you really want to automate Ableton itself, in some new and exciting ways.
Max for live
Max4live is an API accessed only through a clunky “arty codey” quasi-friendly programming language MaxMSP, whose chief selling points are that that
the steepness in the learning curve is engineered to occur after you have paid the license fee, and
it is Turing complete. Although if Alan Turing's had modeled his famous Universal Machine off MaxMSP, the paper tape would have been on fire.
Not only can it automate certain features of Ableton, it can also do DSP. While this seems nice, in fact the experience of writing MaxMSP code is horrible and it locks you in to this one expensive, esoteric platform. Why not write your plugins in csound and run them as VSTs anywhere, or in supercollider and plug them in using Jack?
sync with supercollider: atk.scsync handles tempo-syncing with supercollider. You can use Jack to plug the two together, and ignore the worst of Ableton.
Sebastian Tomczak is a patient saint who creates simple hacks using Max and Live, probably hundreds by now, and they all do elegant and wonderful things that do not involve butting against the limitations of the platform.
On the plus side, the API is rich - you can do DSP and MIDI inside Ableton. It's also officially supported by the manufacturer. Moreover, Max for Live does have a lot of market-share and hence a lot of community around it, which makes up for a many evils. Then again, there are other fetishes for putting weird things on penis that likely have an even larger community, and lots of those have more entertaining failure modes if you do them on stage.
Anyway, we push on.
But mark ye; avoid the following mistakes, for I have already made them for you, and shy from the following horrible flaws, lest ye be disappointed.
String values are returned with quotes in the string. Set the value of a LiveAPI path and then get it back again. You'll find it is still a string has decorative quotes stuck it, which you then have to remove before you do parse it, or even submit it to the same API again. Why? Who will ever be made a happier person by this?
Float values are returned as some kind of object which looks like a number, but fails if you do arithmetic. So you have to cast your float return values to floats to use them. Maybe they are strings? Who knows? The docs don't. And anyway, why would an internal API only return strings? The simplest explanation I have is that it is always returning me strings then sloppily casting them to floats sometimes, but why the hell would a high-performance DSP program handle floats by casting them to strings sporadically when reading values? The mind quails; I will pretend it is not so. I guess the quotes are there to tell you that the API looks typed, but is JSON, merely to rub in how it would have been no harder for them to expose it as an open web service, but they didn't because they want to shamelessly up-sell you, and are revelling in that fact.
Lots of details are just badly thought out. Such as:
throwing errors doesn't do anything useful. Try it out.
Nicely done and well-maintained. Charlie Robert' high point.
Targets Max, MIDI and Ableton Live.
An alternative. LiveOSC is really poorly documented, but definitely a real thing, and despite being an undocumented hack job is one of the more convenient ways to script live; this is faint but real praise. (NB the equivalent in Bitwig is way easier.)
It doesn't have DSP access, and it doesn't have official recognition. It doesn't even have good documentation or a github repo. However, it is used by cognoscenti-types and is genuinely well-designed, or at least doesn't actively try to piss you off. LiveOSC is a python based interface using the private “control surface” python API to access Ableton over OpenSoundControl as a server. It is based in turn upon LiveAPI, which avoided the network layer but was more fragile and python-specific. pylive uses LiveOSC to control Ableton from a python client and thereby comes full circle. Thanks Daniel Jones for a tidy bit of work there. (Don't be confused; there are two separate python thingies with blandly generic names working together here, but they are completely different.) You can also use LiveOSC with other interfaces, such as Livecontrol 2.
LiveOSC source is here, and livecontrol2 source is here, although I can't find an actual download link for either. pylive is, by the way, dependent upon pyliblo, although they haven't gotten around to documenting that yet.
Ableton sets are gzipped XML. A couple of people have made scripts to parse them.