Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7917749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:15:24+00:00 2026-06-03T15:15:24+00:00

I am working on a script to control itunes for a school play. The

  • 0

I am working on a script to control itunes for a school play. The problem is that I can’t get it to go through the if statements. It does set the variable selectedOption but once it hots the ifs and else ifs it seems to just skip over them.

--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

I commented out the repeats until I can get it to select the correct statement.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T15:15:25+00:00Added an answer on June 3, 2026 at 3:15 pm

    Try:

    set selectedOption to {choose from list myOption} as text
    

    since

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

    is a list.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have working registration script the only problem is that i do not know
I'm trying to write a script that can control different windows from different programs
I'm trying to get a jQuery slide show working on a web control that
I have a script working well for creating ad hoc iPhone builds. I can
working on a script, that calculates the difference between dates retrieved from an API.
I've been trying to get this working and I can't seem to figure it
I am trying to get a script working, but I'm getting this weird error.
Trying to get a login script working, I kept getting the same login page
I have been working on a JQuery script that posts JSON to my asp.net
I have user control (myUserControl.ascx). in that i am trying to append script tag

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.