My script looks like this, really simple
tell application "Terminal"
do script "cd myapp"
do script "heroku console" in window 1
do script "User.count" in window 1
end tell
But I get an “Error in the AppleEvent Routine”. What is wrong with this script? If I type the commands in the Terminal it works.
That’s probably not working because
heroku consoledoesn’t return you to the shell after it finishes, it starts the interactive console.What you need is something that will run and return. Fortunately this is totally possible with Heroku:
You can call
consolewith a command to run as the argument. Then it returns the result immediately instead of starting up the interactive session. Sounds perfect for you!