2011-08-16 27 views
0

これは非常に簡単なスクリプトですが、未定義の変数についてのエラーメッセージが表示され続けます。私がすると、= "App Store"の直前にあるresultが強調表示されます。私はスクリプトのその部分を書き直そうとしましたが、同じことが起こり続けます。誰かが問題に気付くことができますか?AppleScriptの未定義変数

say "Welcome, Master Daniel. It is currently" 
say time string of (current date) 
say "All systems are operational. Would you like to open an application?" 
display dialog "Open An Application." buttons ["Mail", "App Store", "More"] 
if button returned of result = "Mail" then 
tell application "Mail" 
    activate 
end tell 

if button returned of result = "App Store" then 
    tell application "App Store" 
     actvate 
    end tell 

else (* do nothing *) 
end if 
else (* do nothing *) 
end if 

if button returned of result = "More" then 
display dialog "Open An Application." buttons ["Safari", "iTunes", "AppleScript"] 

if button returned of result = "Safari" then 
    tell application "Safari" 
     activate 
    end tell 

    if button returned of result = "iTunes" then 
     tell application "iTunes" 
      activate 
     end tell 

     if button returned of result = "AppleScript" then 
      tell application "AppleScript Editor" 
       activate 
      end tell 

     else (* do nothing *) 
     end if 
    else (* do nothing *) 
    end if 
else (* do nothing *) 
end if 
else (*do nothing*) 
end if 

答えて

1

巣のすべての必要はありませんそれらのコマンド。また、結果を変数に取り込みます。だから...

display dialog "Open An Application." buttons ["Mail", "App Store", "More"] 
set the button_pressed to the button returned of the result 

if button_pressed = "Mail" then 
    tell application "Mail" 
     activate 
    end tell 
end if 

if button_pressed = "App Store" then 
    tell application "App Store" 
     activate 
    end tell 
end if 
0

試してみてください。

set question to display dialog "Open An Application." buttons ["Mail", "App Store", "More"] 

set answer to button returned of question 

if answer is equal to "Mail" then 

および "App Storeの"

if answer is equal to "App Store" then 

と "もっと" のための

if answer is equal to "More" then