PowerPoint Programmatically open/play mediaobject in add-in - vba

I am working on a VSTO PowerPoint 2010 add-in which will allow the user to playback a media object (video or audio) in a windows form using windows media player control.
In which way can I extract the embedded media object an play it back to the user?
I have access to the objects name, will that be enough to get to the embedded object?

Kinda yes and no.
The "No". Through VBA and VSTO, the answer is no or at least I've never seen it done before and have no idea. I've looked at this before and didn't find it to be possible.
The "Kinda Yes". Any embedded media in 2007/2010 can be extracted through Open XML. Here's where the "kinda" comes in - you can extract it so long as you know what you're extracting. Sounds easy enough, but it's not. When you insert a video or audio piece, it gets embedded into a shape. That shape is given a name[1], which is the file name of the audio/video file. So if I insert the sample video that comes with Win7, my shape name that holds the video is "wildlife.wmv". It can easily be renamed by an end user who knows how to do so (the Selection Pane in the client) and in that case, it would be impossible to find based on just having the name.
But if it hasn't been renamed, you would open an in-memory copy of your .pptx in Open XML, search on the name in each of the slides in the /ppt/slides/ folder and once found, use it's relationship Id to locate it's name in the /ppt/media folder. Then you can pull it out, save it to disk, play it, etc.
1 PowerPoint, however, renames the file based on an internal naming convention. My "wildlife.wmv" is renamed "media1.wmv" inside the package. Subsequent media items would be named media2.wmv, media1.mpg, etc.

Related

How can you add one of PowerPoint's built in Icons with VBA?

I don't see any methods in the PowerPoint Object Model to add one of PowerPoint's built in icons. I see the ability to add the built in shapes and pictures, but not icons?
How would you do it? Would it be best to just have a slide with the icons I want to use saved somewhere and just copy it off the slide?
It seems that upon looking into the problem further PowerPoint does not have the ability to insert its built in icons using VBA. Additionally, when creating a PPAM file from a PPTM you lose all slides, masters, layouts, etc.
The best way to insert slides or objects on slides is to just create another PPTX file and store it on SharePoint, a share drive, or just distribute a file with your add-in so that you can reference the slides and objects on the slides in your add-in.
The Slides.InsertFromFile method requires a filename and index. The filename is a string and while the example shows a local resource I have tested and it also works with an internet URI (specifically tried a SharePoint resource, but I could do further testing if needed).

Creating a Record Option on a PDF or Word Document

I am going to preface this with the question on a more general scale then go on to explain my specific issue.
Is there a way to create a word document, pdf, or anything comparable that I could add a "Record Audio" button to that would save the audio with the file as well as all the other info that might on a pdf/word form?
I know that Adobe Pro has a leave audio comment option, but I am creating this for a user and I do not want them to have to use that. The reason I need this is that I currently have a form usually gets partially filled out and then passed on with a dictation that needs to be transcribed at a later time. I am aiming to do this so that I can have the form and audio file linked and saved under one file.
If there is a way to leave the audio comment on a pdf with some javascript that is triggered by a button, I am perfectly okay with that I just have no clue how to program that (in terms of syntax, I am comfortable programming that isn't the problem lol).
I am also open to forms of documents other than pdf or word. I only mentioned these as they are the industry standard, but if there is another file type that would work around this, I am more than glad to use it!
I am using word 2013 by the way.
Thanks in advance!
You could write a TaskPane Addin that shows the audio controls. Once the recording is complete, the audio could be saved in the CustomXML parts in the document.
Then other users who receive the document and have your AddIn, will be able to listen to the recording.
I have not verified it in-depth, but it would be possible to add a button to the PDF file which creates a Sound annotation. The user should be then automatically asked (via a dialog) to record it.

Placing a bitmap into a Powerpoint Add-In

All:
I am writing a PowerPoint add-in that will allow a user to drop specific safety related images onto a map. I've written the code that copies the images and places them on the slide and I would like to place it into an add-in. Unfortunately, I cannot find a way to either:
a) place the images into the add-in
b) reference images if I were able to place them in the add-in
The alternative approach is to require the user to start with a special template that includes all of the images and then load the add-in to get the menu functionality. I would much rather have a single file that contains both the code and bitmap images.
With best regards,
Walt
PPA files contain only code, not presentation content like images. As an alternative, you could distribute a PPT/PPTX that you open invisibly and extract the image you need.
After quite a bit of looking around I found a solution that resolves the problem adequately. Using Microsoft's Custom UI Editor, I created an XML entry in the PowerPoint Presentation that performs the Auto_Open function that would have been part of the Add-In. This allows me to add the menu functions that will be responsible for loading the specific images.
I've added a reference page at the beginning of the presentation that contains instructions on how to use the template... This page also contains all of the images that are used by the visual basic code. The 'Visible' flag on these images are set to False so the user does not see them. As they are copied from the reference page into the presentation, the Visible flag is set to True and they are pasted onto the current slide.
It is not a perfect solution, but it is adequate...

Best way to deploy a mobile Powerpoint Add In

Do any of you know what the best way is to deploy a mobile Powerpoint Add-In?
I developed an add-in that logs the time whenever a teacher switches slides, and also exports all the slides as separate JPEG files. This is necessary, because we also record the presentations on video, and want to combine the two using a second-screen. The whole back-end behind this is finished and is working (but we need to manually type in the positions of the 'slide'. So we figured we could automate this).
The users the add in needs to run on don't have any Administrator rights, and we don't have access to the administrator account either (this is in an Educational environment). But we do need to launch a Powerpoint application with the add in already installed, so we can record the presentation.
Can you write a few entries to the registry, in HKEY_CurrentUser? Specifically:
HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\PowerPoint\AddIns\YourAddinName
Under that, add a new
String: Path = the full path to your add-in's PPA/PPAM file
DWORD: AutoLoad = ffff ffff hex
That will cause PPT to load your add-in automatically when it starts up.

Using Office 2007 extension (i.e. docx) for skin based On-Screen keyboard

I'm creating a On-Screen keyboard for my application, and it supports skins as well.
Here's what I'm doing with the skins, I have a folder which contains some images and a xml file which maps the images to the keyboard, I want to be able to have the folder as a zip file like in Office 2007 (.docx) and iPhone firmwares (.ipsw), I know I can simply zip the folder and change the extension, what I need to know is how to read the files in the code.
You've got two options, either 1) just use a zip library like SharpZipLib or DotNetZip or 2) try to use the System.IO.Packaging namespace. I think option 1 would be the easiest probably.
There's nothing really magical that Office and other programs are doing, they're just reading a zip file and pulling stuff out of it as needed. Instead of pulling an image from a disk you just pull it from a MemoryStream.