I am attempting to use Applescript to do the exactly the same thing as is done manually following this procedure in Powerpoint
- Select following from menu bar
a. Insert → Sound and Music → From file .
b. Select file and click insert button
c. Click automatically on selection box “How do you want the sound to start in the slide show?”
The following is a prototype script I wrote to accomplish this that does not entirely work
local myFile
set myFile to ((path to desktop) as string) & "bl06.ppt"
local myMediaFile
set myMediaFile to ((path to desktop) as string) & "01.wav"
tell application "Microsoft PowerPoint"
-- Bring powerpoint to front
activate
-- Open presentation
open myFile
-- Add sound that autoplays when slide 1 starts in slide show mode
tell slide 1 of active presentation
-- Create media shape and embed sound in it
set theMediaObject to make new media object at end with properties {top:200, left position:-40, lock aspect ratio:true, file name:myMediaFile}
-- Get animation settings object from media shape object
set theAnim to animation settings of theMediaObject
-- Enable animation
set animate of theAnim to true
-- Animate at all levels
set text level effect of theAnim to animate level all levels
end tell
end tell
This almost works. When I got to slide show mode on slide one it does not auto-play, but when I hit page down it says on slide one and plays.
When I look at the “Custom Animation” settings of the shape I find that it puts 2 entries in its animation order for “01.wav” the first of which is an entrance effect the second of which is a media action. The second one looks identical to what the manual process above. If I manually delete the entrance effect item in the animation order it works like I want. I have tried all kinds of variations of toying with the settings to get the end result I want to no avail.
I am using Mac OS 10.5.2/Script Editor 2.2 for Applescript 2.0/Microsoft Powerpoint 2008 version 12.1.5.