Created
June 20, 2012 21:33
-
-
Save mamuso/2962366 to your computer and use it in GitHub Desktop.
Play a sound during multiple slides in keynote with AppleScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set dontplay to 0 | |
tell application "Keynote" | |
start from slide 1 of front slideshow | |
end tell | |
set volume output volume 80 | |
repeat | |
tell application "Keynote" | |
tell front slideshow | |
-- Start a song | |
if get slide number of current slide is 2 and dontplay is 0 then | |
set dontplay to 1 | |
tell application "Play Sound" | |
-- This sound part maybe is interesting just when you are playing a sound before | |
repeat until output volume of (get volume settings) ≤ 0 | |
delay 0.2 | |
set volume output volume ((output volume of (get volume settings)) - 5) | |
get output volume of (get volume settings) | |
end repeat | |
set volume output volume 80 | |
play alias "Macintosh HD:Users:path_to.mp3" | |
end tell | |
end if | |
-- Reset dontplay on the next slide | |
if get slide number of current slide is 3 then | |
set dontplay to 0 | |
end if | |
-- Repeat the schema for each slide you want to start a new song :) | |
end tell | |
end tell | |
end repeat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment