I've been trying to execute applescript code through XPCOM, but no matter what I do it just doesn't seem to work, the observer tells me that the process finishes without a problem, but nothing happens.
var processArgs = ['-e','\'tell application "iTunes"\'','-e','\'activate\'','-e','\'end tell\''];
var file = Cc["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsIFile);
file.initWithPath( '/usr/bin/osascript');
var process = Cc["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
process.init( file );
var observer = {
observe: function( subject, topic ) {
SiteFusion.consoleMessage('DONE ' + topic);
}
}
process.runAsync( processArgs, processArgs.length, observer );
The output in the console is 'DONE process-finished' so it should have worked, does anyone know why this script refuses to open iTunes?