tags:

views:

48

answers:

1

I am very new to applescript and am working based off of a script I received from someone else, but I am having issues changing the channel with an application I created using Interface Builder from XCode for the application EyeTV by Elgato. I keep getting an error saying "command /usr/bin/osacompile failed with exit code 1". I included the code below

global theChannel
global theApp
global theMachine
property theMachine : "10.0.2.2"

on change_channel(channel_number)
set theChannel channel_number as integer
tell application "EyeTV" of machine theMachine
«event EyTVChch» given «class Chnm»: theChannel
end tell
end change_channel

on clicked theObject
set theApp to application "EyeTV" of machine theMachine
if name of theObject is "fox" then
change_channel(2)
else if name of theObject is "cbs" then
change_channel(3)
else if name of theObject is "nbc" then
change_channel(4)
else if name of theObject is "pbs" then
change_channel(5)
else if name of theObject is "cw" then
change_channel(6)
else if name of theObject is "abc" then
change_channel(7)
else if name of theObject is "twc" then
change_channel(9)
else if name of theObject is "bt" then
change_channel(10)
else if name of theObject is "fs" then
change_channel(11)
else if name of theObject is "cs" then
change_channel(12)
else if name of theObject is "espn" then
change_channel(13)
else if name of theObject is "espn2" then
change_channel(14)
else if name of theObject is "espnu" then
change_channel(15)
else if name of theObject is "dh" then
change_channel(20)
else if name of theObject is "dc" then
change_channel(29)
else if name of theObject is "tlc" then
change_channel(30)
else if name of theObject is "sc" then
change_channel(31)
else if name of theObject is "ng" then
change_channel(32)
else if name of theObject is "hc" then
change_channel(33)
else if name of theObject is "fn" then
change_channel(34)
else if name of theObject is "msnbc" then
change_channel(35)
else if name of theObject is "cnbc" then
change_channel(36)
else if name of theObject is "hn" then
change_channel(37)
else if name of theObject is "cnn" then
change_channel(39)
else if name of theObject is "cspan2" then
change_channel(41)
else if name of theObject is "cspan" then
change_channel(42)
else if name of theObject is "rc" then
change_channel(53)
else if name of theObject is "wolv" then
change_channel(55)
else if name of theObject is "rham" then
change_channel(56)
else if name of theObject is "rctv" then
change_channel(57)
else if name of theObject is "rlc" then
change_channel(58)
end if
end clicked

on will finish launching theObject
tell window "Main"
set theAddress to text returned of (display dialog "Enter the IP of the remote computer:" default answer "10.0.2.2" default button 2)
set theMachine to "eppc://" & theAddress
end tell
set theApp to application "EyeTV" of machine theMachine
using terms from application "Script Editor"
tell theApp
activate
if «class Fuls» is true then
set title_fullscreen to "Exit Full Screen"
else if «class Fuls» is false then
set title_fullscreen to "Enter Full Screen"
end if
set theChannel to «class Crch»
end tell
end using terms from
tell window "Main"
set title of button "fullscreen" to title_fullscreen
set the contents of text field "channel_number" to theChannel
set title of button "eyetv_quit" to "Quit EyeTV"
set isOpen to 1 as integer
end tell
end will finish launching

on will close theObject
quit
end will close
+1  A: 

You have a number of syntax errors in your script. Try pasting the script into the AppleScript Script Editor and hitting "Compile". Here's a few I found:

set theChannel channel_number as integer

should be:

set theChannel to channel_number as integer

on clicked theObject

should be:

on clicked(theObject)

on will finish launching theObject

is a syntax error, but I'm not sure what the solution is... I also got a few more syntax errors, and the syntax looked correct so I think it might just be that I don't have EyeTV.

Josh