2010-05-19 4 views
0

Je suis très nouveau à applescript et je travaille basé sur un script que j'ai reçu de quelqu'un d'autre, mais j'ai des problèmes pour changer le canal avec une application créée avec Interface Builder de XCode pour l'application EyeTV par Elgato. Je reçois toujours une erreur indiquant que "command/usr/bin/osacompile a échoué avec le code de sortie 1". J'ai inclus le code ci-dessousApplescript, aide de base s'il vous plaît! (Essayer de contrôler 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 

Répondre

1

Vous avez un certain nombre d'erreurs de syntaxe dans votre script. Essayez de coller le script dans l'éditeur de script AppleScript et appuyez sur "Compiler". Voici quelques j'ai trouvé:

set theChannel channel_number as integer 

devrait être:

set theChannel to channel_number as integer 

on clicked theObject 

devrait être:

on clicked(theObject) 

on will finish launching theObject 

est une erreur de syntaxe, mais je ne suis pas sûr de la solution ... J'ai également eu quelques erreurs de syntaxe, et la syntaxe semblait correcte, donc je pense que c'est peut-être que je n'ai pas EyeTV.