- Joined
- May 5, 2010
- Messages
- 1
- Reaction score
- 0
- Points
- 1
hi ive been trying to make this script work
but im quite new to applescript and i cant figure out whats wrong with it
id appreciate whatever help you could give
im running speech recognition software on mac os x 10.5.8 leopard
thanks
x
script:
set theOptions to {"i have had a very pleasant day sir.","oh you know, just been crunching some numbers.","quite bad, my cpu's been full up, all day!","well it is rather boring without you sir!"}
set theChoice to some item of theOptions
say theChoice displaying theChoice
if theChoice is equal to "i have had a very pleasant day sir." then
tell application "speech feedback"
listen for("good to hear Jarviss.", "im glad your day went well.", "thats good.")
if "good to hear Jarviss." then
set theOptions to {"thank you sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
if "im glad you day went well." then
set theOptions to {"thank you sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
if "thats good." then
set theOptions to {"thank you sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
end tell
if the theChoice is equal to"oh you know, just been crunching some numbers." then
tell application "speech feedback"
listen for ("i hope it went well.", "im glad you got some work done.", "thats good.")
end tell
if "i hope it went well." then
set theOptions to {"and I also sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
if "im glad you got some work done." then
set theOptions to {"me too sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
if "thats good." then
set theOptions to {"yes, it is sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
else
if theChoice is equal to"quite bad, my cpu's been full up, all day!" then
tell application "speech feedback"
listen for("im sorry to hear that Jarviss.", "im glad you fixed it.", "thats too bad.")
end tell
if "im sorry to hear that Jarviss." then
set theOptions to {"thank you for thee condolences sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
if "im glad you fixed it." then
set theOptions to {"no problem is too large for me sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
if "thats too bad." then
set theOptions to {"i agree sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
if theChoice is equal to"well it is rather boring without you sir!" then
tell application "speech feedback"
listen for("always loyal Jarviss.", "im flattered.", "thats nice of you Jarviss.")
end tell
if "always loyal Jarviss." then
set theOptions to {"always and forever sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
if "im flattered." then
set theOptions to {"i mean it sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
if "thats nice of you Jarviss." then
set theOptions to {"im pleased you think so sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
BTW this is for a home automation system, im setting up on my mac, similar to chad barraford's project J.A.R.V.I.S.
oh and ive spelt it jarviss because that is easier for my mac to understand.
EDIT:
i now edited it to try this script
set theOptions to {"i have had a very pleasant day sir.","oh you know, just been crunching some numbers.","quite bad, my cpu's been full up, all day!","well it is rather boring without you sir!"}
set theChoice to some item of theOptions
say theChoice displaying theChoice
if theChoice is equal to "i have had a very pleasant day sir." then
tell application "speech feedback"
listen for("good to hear Jarviss.", "im glad your day went well.", "thats good.")
if "good to hear Jarviss." then
set theOptions to {"thank you sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
else if "im glad you day went well." then
set theOptions to {"thank you sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
else if "thats good." then
set theOptions to {"thank you sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
end tell
if the theChoice is equal to"oh you know, just been crunching some numbers." then
tell application "speech feedback"
listen for ("i hope it went well.", "im glad you got some work done.", "thats good.")
if "i hope it went well." then
set theOptions to {"and I also sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
else if "im glad you got some work done." then
set theOptions to {"me too sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
else if "thats good." then
set theOptions to {"yes, it is sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
end tell
if theChoice is equal to"quite bad, my cpu's been full up, all day!" then
tell application "speech feedback"
listen for("im sorry to hear that Jarviss.", "im glad you fixed it.", "thats too bad.")
if "im sorry to hear that Jarviss." then
set theOptions to {"thank you for thee condolences sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
else if "im glad you fixed it." then
set theOptions to {"no problem is too large for me sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
else if "thats too bad." then
set theOptions to {"i agree sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
end tell
if theChoice is equal to"well it is rather boring without you sir!" then
tell application "speech feedback"
listen for("always loyal Jarviss.", "im flattered.", "thats nice of you Jarviss.")
if "always loyal Jarviss." then
set theOptions to {"always and forever sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
else if "im flattered." then
set theOptions to {"i mean it sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
else if "thats nice of you Jarviss." then
set theOptions to {"im pleased you think so sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
end tell
but im quite new to applescript and i cant figure out whats wrong with it
id appreciate whatever help you could give
im running speech recognition software on mac os x 10.5.8 leopard
thanks
x
script:
set theOptions to {"i have had a very pleasant day sir.","oh you know, just been crunching some numbers.","quite bad, my cpu's been full up, all day!","well it is rather boring without you sir!"}
set theChoice to some item of theOptions
say theChoice displaying theChoice
if theChoice is equal to "i have had a very pleasant day sir." then
tell application "speech feedback"
listen for("good to hear Jarviss.", "im glad your day went well.", "thats good.")
if "good to hear Jarviss." then
set theOptions to {"thank you sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
if "im glad you day went well." then
set theOptions to {"thank you sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
if "thats good." then
set theOptions to {"thank you sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
end tell
if the theChoice is equal to"oh you know, just been crunching some numbers." then
tell application "speech feedback"
listen for ("i hope it went well.", "im glad you got some work done.", "thats good.")
end tell
if "i hope it went well." then
set theOptions to {"and I also sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
if "im glad you got some work done." then
set theOptions to {"me too sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
if "thats good." then
set theOptions to {"yes, it is sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
else
if theChoice is equal to"quite bad, my cpu's been full up, all day!" then
tell application "speech feedback"
listen for("im sorry to hear that Jarviss.", "im glad you fixed it.", "thats too bad.")
end tell
if "im sorry to hear that Jarviss." then
set theOptions to {"thank you for thee condolences sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
if "im glad you fixed it." then
set theOptions to {"no problem is too large for me sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
if "thats too bad." then
set theOptions to {"i agree sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
if theChoice is equal to"well it is rather boring without you sir!" then
tell application "speech feedback"
listen for("always loyal Jarviss.", "im flattered.", "thats nice of you Jarviss.")
end tell
if "always loyal Jarviss." then
set theOptions to {"always and forever sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
if "im flattered." then
set theOptions to {"i mean it sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
if "thats nice of you Jarviss." then
set theOptions to {"im pleased you think so sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
BTW this is for a home automation system, im setting up on my mac, similar to chad barraford's project J.A.R.V.I.S.
oh and ive spelt it jarviss because that is easier for my mac to understand.
EDIT:
i now edited it to try this script
set theOptions to {"i have had a very pleasant day sir.","oh you know, just been crunching some numbers.","quite bad, my cpu's been full up, all day!","well it is rather boring without you sir!"}
set theChoice to some item of theOptions
say theChoice displaying theChoice
if theChoice is equal to "i have had a very pleasant day sir." then
tell application "speech feedback"
listen for("good to hear Jarviss.", "im glad your day went well.", "thats good.")
if "good to hear Jarviss." then
set theOptions to {"thank you sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
else if "im glad you day went well." then
set theOptions to {"thank you sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
else if "thats good." then
set theOptions to {"thank you sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
end tell
if the theChoice is equal to"oh you know, just been crunching some numbers." then
tell application "speech feedback"
listen for ("i hope it went well.", "im glad you got some work done.", "thats good.")
if "i hope it went well." then
set theOptions to {"and I also sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
else if "im glad you got some work done." then
set theOptions to {"me too sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
else if "thats good." then
set theOptions to {"yes, it is sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
end tell
if theChoice is equal to"quite bad, my cpu's been full up, all day!" then
tell application "speech feedback"
listen for("im sorry to hear that Jarviss.", "im glad you fixed it.", "thats too bad.")
if "im sorry to hear that Jarviss." then
set theOptions to {"thank you for thee condolences sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
else if "im glad you fixed it." then
set theOptions to {"no problem is too large for me sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
else if "thats too bad." then
set theOptions to {"i agree sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
end tell
if theChoice is equal to"well it is rather boring without you sir!" then
tell application "speech feedback"
listen for("always loyal Jarviss.", "im flattered.", "thats nice of you Jarviss.")
if "always loyal Jarviss." then
set theOptions to {"always and forever sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
else if "im flattered." then
set theOptions to {"i mean it sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
else if "thats nice of you Jarviss." then
set theOptions to {"im pleased you think so sir, how was your day?"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
end tell