http://autokey.sourceforge.net/apidoc/
http://autokey.sourceforge.net/apidoc/lib.scripting.Mouse-class.html
This may seem obvious once you know, but I haven't seen it mentioned anywhere else. In order to turn a Phrase into a Script, choose Edit > Convert to Script. If you don't do this, Autokey will just paste your script's code instead of running i