2012-05-07 14 views
2

私は学校での再生のためにスクリプトを操作するスクリプトを作成しています。問題は、私はそれがifステートメントを通過することができないということです。それは変数selectedOptionを設定しますが、一度それがifsとそれ以外の場合はそれを飛ばしているように見えます。if/else ifとリストを使用しているAppleScript

--repeat 
activate 
set myOption to {"Start Play", "Scene 1", "Between Scenes", "Scene 2", "Next Song", "End Play"} 
set selectedOption to {choose from list myOption} 
---------End Play--------- 
if selectedOption is "End Play" then 
    tell application "iTunes" 
     set currentvolume to the sound volume 
     if (player state is playing) then 
      -- if so, fade out the current track 
      repeat with i from currentvolume to 0 by -2 
       set the sound volume to i 
       delay 0.1 
      end repeat 
      stop 
     end if 
    end tell 
    display dialog "Volume Back Up?" buttons {"Full", "80", "End"} default button "Full" 
    if the selectedOption is "Full" then 
     tell application "iTunes" 
      set sound volume to 100 
     end tell 
    else if the selectedOption is "80" then 
     tell application "iTunes" 
      set sound volume to 80 
     end tell 
    end if 
    exit repeat 
    ---------Scene 1--------- 
else if the selectedOption is "Scene 1" then 
    tell application "iTunes" 
     -- get the initial volume 
     set currentvolume to the 60 
     -- are we playing? 
     if (player state is playing) then 
      -- if so, fade out the current track 
      repeat with i from currentvolume to 0 by -2 
       set the sound volume to i 
       delay 0.02 
      end repeat 
      next track 
     end if 
     -- now, regardless of whether we were playing or not, fade in the next track 
     set the sound volume to 0 
     play playlist "2012 Play Christmas" 
     repeat with j from 0 to currentvolume by 2 
      set the sound volume to j 
      delay 0.02 
     end repeat 
     --do shell script "open ~/Desktop/2.app" 
     exit repeat 
    end tell 
    ---------Between Scenes--------- 
else if the selectedOption is "Between Scenes" then 
    tell application "iTunes" 
     -- get the initial volume 
     set currentvolume to the 60 
     -- are we playing? 
     if (player state is playing) then 
      -- if so, fade out the current track 
      repeat with i from currentvolume to 0 by -2 
       set the sound volume to i 
       delay 0.02 
      end repeat 
      next track 
     end if 
     -- now, regardless of whether we were playing or not, fade in the next track 
     set the sound volume to 0 
     play playlist "2012 Play Intermission" 
     repeat with j from 0 to currentvolume by 2 
      set the sound volume to j 
      delay 0.02 
     end repeat 
    end tell 
    ---------Scene 2--------- 
else if the selectedOption is "Scene 2" then 
    tell application "iTunes" 
     -- get the initial volume 
     set currentvolume to the 60 
     -- are we playing? 
     if (player state is playing) then 
      -- if so, fade out the current track 
      repeat with i from currentvolume to 0 by -2 
       set the sound volume to i 
       delay 0.02 
      end repeat 
      next track 
     end if 
     -- now, regardless of whether we were playing or not, fade in the next track 
     set the sound volume to 0 
     play playlist "2012 Play Christmas2" 
     repeat with j from 0 to currentvolume by 2 
      set the sound volume to j 
      delay 0.02 
     end repeat 
    end tell 
    ---------Next Song--------- 
else if the selectedOption is "Next Song" then 
    tell application "iTunes" 
     -- get the initial volume 
     set currentvolume to the 60 
     -- are we playing? 
     if (player state is playing) then 
      -- if so, fade out the current track 
      repeat with i from currentvolume to 0 by -2 
       set the sound volume to i 
       delay 0.02 
      end repeat 
      next track 
     end if 
     -- now, regardless of whether we were playing or not, fade in the next track 
     set the sound volume to 0 
     play 
     repeat with j from 0 to currentvolume by 2 
      set the sound volume to j 
      delay 0.02 
     end repeat 
    end tell 
    ---------Begin Play--------- 
else if the selectedOption is "Begin Play" then 
    tell application "iTunes" 
     set sound volume to 100 
     play playlist "2012 Play Intro" 
    end tell 
end if 
--end repeat 

正しい文を選択するまでリピートをコメントアウトしました。

答えて

3

試してみてください。

set selectedOption to {choose from list myOption} as text 

set selectedOption to {choose from list myOption} 
return class of selectedOption 

はリストであるから。

+0

ありがとうございました! – WatsonN

関連する問題