This is a script which outputs the currently playing info for iTunes 4 then turns it into an image and finally uploads it to the Internet. My question comes in the formatting of the output.
Code:
function running() {
return appleScript('tell application "System Events"\nreturn number of (application processes whose name is equal to "iTunes")\nend tell\n');
}
function tell(command) {
return appleScript('tell application "iTunes"\n' + command + '\nend tell\n');
}
function state() {
return tell('return player state as string');
}
function write(artist, album, title) {
var target = resolvePath(preferences.target.value);
runCommand('echo "' + artist + '" > ' + target + ';' +
'echo "' + album + '" >> ' + target + ';' +
'echo "' + title + '" >> ' + target);
}
function update() {
if (running() != 0 && state() != 'stopped') {
var artist = tell('return artist of current track');
var album = tell('return album of current track');
var title = tell('return name of current track');
write(artist, album, title);
} else {
write('Nothing is currently being played.', '', '');
}
}
update();
That outputs this:
Matchbox Twenty
Yourself or Someone Like You
Push
I want all the information to be displayed on one line, and in this format:
Is this possible?
Bookmarks