0
我對applescript非常陌生,我的工作基於我從別人那裏收到的腳本,但是我遇到的問題是通過使用Interface Builder從XCode爲應用程序創建的應用程序更改頻道ElTVato的EyeTV。我不斷收到一個錯誤,說「命令/ usr/bin/osacompile失敗,退出代碼1」。我將下面的代碼包含在內請注意,基本的幫助! (試圖控制Elgato EyeTV)
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