私はここ数日間、Applescript で独自のバージョンの Jarvis をコーディングしてきました。ポータブルな方法が気に入っているので、入力と出力として iMessages を使用していますが、もう少し高度になり、それを感じさせたいと思っています。用途があるような。
現在、単純なコード行を使用して何かを送信したことを認識し、適切なスクリプトを実行して返信を送信しています。たとえば、「こんにちは」と言うと、「こんにちは」と返ってきます。
例は次のとおりです。
using terms from application "Messages"
on message received theMessage from theBuddy for theChat
if theMessage is "hello" then
run script ("/Users/Alex/Desktop/JarvisScripts/hello.scpt" as POSIX file)
end if
end message received
end using terms from
大丈夫ですが、前に言ったように、さらに先に進みたいのですが、「お元気ですか」などの質問をする方法が必要です。 「良い」に応答するための正しいスクリプト。私の現在の試みは次のとおりです。
if theMessage contains "Are you ok" then
run script ("/Users/Alex/Desktop/JarvisScripts/areyouok.scpt" as POSIX file)
if theMessage is "I'm fine" then
run script ("/Users/Alex/Desktop/JarvisScripts/happy.scpt" as POSIX file)
else
if theMessage is "No I'm not" then
run script ("/Users/Alex/Desktop/JarvisScripts/unhappy.scpt" as POSIX file)
end if
end if
end if
しかし、私はこれが正しくないことを知っています。それで、誰かがコードで私を助けることができますか? ありがとう