2017-02-12 7 views
1

私は表示ダイアログボックスで3つの異なるアクションを選択できるスクリプトを作成しようとしていますが、テストすると最初のオプションだけが機能します。これが私のプログラムの中心点であるため、これを回避する方法がありますか?どんな助けもありがとうございます。3つの結果を含むダイアログを表示しますか?

この場合、選択した1つのスクリプトだけが機能し、残りの2つは失敗します。

答えて

0

あなたは正しい軌道に乗っていました。これは、そこ冗長性の多くは、あなたのコードであり、3つの別々のif句は効率的ではありませんあなた

set myQuery to display dialog "selection?" buttons {"choice 1", "choice 2", "choice 3"} 
if button returned of myQuery is "choice 1" then 
    say "you selected choice one" --replace this line with what ever you want 
end if 
if button returned of myQuery is "choice 2" then 
    say "you selected choice two" --replace this line with what ever you want 
end if 
if button returned of myQuery is "choice 3" then 
    say "you selected choice three" --replace this line with what ever you want 
end if 
+0

お返事ありがとうございます。私はとても近づいていたが、今私は答えがあることを理解している。あなたの助けをもう一度ありがとう! :) – user7439349

+0

私は欲求不満を理解しています。私はAppleScriptが初めてで、私が思いつくことができる唯一の解決策は、読まれた読書と練習の練習です。しかし、それは楽しいです...全体のプロセス。 – wch1zpink

0

のために働く必要があります。

set {button returned:myQuery} to display dialog "selection?" buttons {"choice 1", "choice 2", "choice 3"} 
if myQuery is "choice 1" then 
    say "choice one" 
else if myQuery is "choice 2" then 
    say "choice two" 
else 
    say "choice three" 
end if 
+0

ヘッドアップありがとう。私はまだ学んでいるが、あなたがそれを指摘していただきありがとうございます。 – wch1zpink

関連する問題