Consulting

Results 1 to 6 of 6

Thread: Using If/Then statements to play audio clips

  1. #1

    Using If/Then statements to play audio clips

    I've searched around and there's nothing that was clear or easy for me to apply to my projects. What I'd like to accomplish is when I click on a shape to reveal a score, it will play a ding sound. If the score is 0, then a buzzer sound would play instead. Another project would be click a button to change font color for text boxes, play a ding sound. If it couldn't find any text to change, play a buzzer. If this is all possible, would you be able to provide some code for me to adjust and apply to my projects? Thanks for your time!

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    Try adding shapes to the slide master named "ding" (they can be invisible - no line transparent fill or just of slide)

    As an example use Insert > Action to add a ding sound on click

    You can play this from code

    Dim oshp As Shape
    Set oshp = ActivePresentation.SlideMaster.Shapes("ding")
    oshp.ActionSettings(ppMouseClick).SoundEffect.Play
    Should be easy to adapt to If / Then situations
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    Works like a champ, and much more manageable. Thanks, John!

  4. #4
    VBAX Regular
    Joined
    Feb 2022
    Posts
    37
    Location
    Great method !
    Helped me too, Thanks.

  5. #5
    VBAX Newbie
    Joined
    Apr 2022
    Location
    Singapore
    Posts
    1
    Location
    Quote Originally Posted by John Wilson View Post
    Try adding shapes to the slide master named "ding" (they can be invisible - no line transparent fill or just of slide)

    As an example use Insert > Action to add a ding sound on click.

    You can play this from code

    Dim oshp As Shape
    Set oshp = ActivePresentation.SlideMaster.Shapes("ding")
    oshp.ActionSettings(ppMouseClick).SoundEffect.Play

    Should be easy to adapt to If / Then situations
    Thanks a lot it worked.

  6. #6
    VBAX Newbie
    Joined
    Aug 2023
    Posts
    2
    Location
    Quote Originally Posted by albino_pygmy View Post
    I've searched around and there's nothing that was clear or easy for me to apply to my projects. What I'd like to accomplish is when I click on a shape to reveal a score, it will play a ding sound. If the score is 0, then a buzzer sound would play instead. Another project would be click a button to change font color for text boxes, play a ding sound. If it couldn't find any text to change, play a buzzer. If this is all possible, would you be able to provide some code for me to adjust and apply to my projects? Thanks for your time!
    Certainly!
    It sounds like you're interested in adding interactive elements to your projects. Achieving these goals is definitely possible with programming. For the first project, you can use JavaScript to detect the score and play either a ding or buzzer sound accordingly. For the second project, you can change the font color and trigger the sound effect when a button is clicked. youtube vanced

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •