evanlifetv
Member
Hey guys, running into an issue when trying to use the sample code provided to fire off some applescript commands, whether I run this command from Haiku, or from HH. Here is the error I receive:
"Unhandled exception in script on line: 27 in function onButtonActivate: executeAppleScript(): AppleScript error: iTunes got an error: Application isn’t running."
Clearly iTunes is running, I have it open, can see playlists etc...
Here is my code (straight from the sample I believe)
// iTunes Code
function onButtonActivate(button) {
if(button.name == 'iTunes Play') {
helper.executeAppleScript(controller, 'tell application "iTunes" to play');
} else if(button.name == 'iTunes Pause') {
helper.executeAppleScript(controller, 'tell application "iTunes" to pause');
} else if(button.name == 'iTunes Prev') {
helper.executeAppleScript(controller, 'tell application "iTunes" to skip to previous track');
} else if(button.name == 'iTunes Next') {
helper.executeAppleScript(controller, 'tell application "iTunes" to skip to next track'); }
}
// End iTunes Code
I have also tried subbing in some other commands like 'tell application "Safari" to activate' (which should just launch Safari) These commands all work when pasted straight into Applescript Editor, I'm hoping I'm missing something simple. Any input or thoughts you can give you would be great.
"Unhandled exception in script on line: 27 in function onButtonActivate: executeAppleScript(): AppleScript error: iTunes got an error: Application isn’t running."
Clearly iTunes is running, I have it open, can see playlists etc...
Here is my code (straight from the sample I believe)
// iTunes Code
function onButtonActivate(button) {
if(button.name == 'iTunes Play') {
helper.executeAppleScript(controller, 'tell application "iTunes" to play');
} else if(button.name == 'iTunes Pause') {
helper.executeAppleScript(controller, 'tell application "iTunes" to pause');
} else if(button.name == 'iTunes Prev') {
helper.executeAppleScript(controller, 'tell application "iTunes" to skip to previous track');
} else if(button.name == 'iTunes Next') {
helper.executeAppleScript(controller, 'tell application "iTunes" to skip to next track'); }
}
// End iTunes Code
I have also tried subbing in some other commands like 'tell application "Safari" to activate' (which should just launch Safari) These commands all work when pasted straight into Applescript Editor, I'm hoping I'm missing something simple. Any input or thoughts you can give you would be great.