Fluxo de trabalho do automatizador JavaScript para controlar o Spotify via Launchbar

Acabei de escrever este snippet para controlar o Spotify usando um fluxo de trabalho de automação escrito em JavaScript!

function run(input, parameters) {
// commands for play/pause
var playpauseCommands = new Array("play", "pause", "stop");

// commands for next track
var nextCommands = new Array("next", "n");

// commands for previous track
var prevCommands = new Array("previous", "prev", "p");

var inputString = input[0].toLowerCase();
var Spotify = Application('com.spotify.client');
if(playpauseCommands.indexOf(inputString) != -1) {
Spotify.playpause();
} else if(nextCommands.indexOf(inputString) != -1) {
Spotify.nextTrack();
} else if(prevCommands.indexOf(inputString) != -1) {
Spotify.previousTrack();
}
//return input;
}