3 Replies Latest reply on May 18, 2010 4:32 PM by Brom Kim

    VBA Scripting for Presenter in PPT?

    mheydman

      I frequently have to import videos into slides.... say Clip1.avi, Clip2.avi, Clip3.avi.....Clip47.avi etc

       

      Rather than manually import video onto every slide (believe me, this gets time consuming and is prone to error!)  I was hoping to do some VBA coding something like this:

       

      Dim p As Appplication.Presenter


      Set p = ActivePresentation.Presenter


      For i = 1 to p.Slides.Count

           p.Slides(i).ImportVideo "Clip" & i & ".avi", Presenter_Sidebar, Presenter_400K

      Next

       

       

      Ok, so that is totally made up code, the "Presenter_" constants referenced in the ImportVideo method are mere figments of my imagination. But imagine running this macro and importing sidebar video for 50 slides  with 1 click. Cool!

       

      So is something like this possible? Even if I could hack some xml by writing a script to automatically add videos to the presentation that way....

       

      Thanks,

       

      Matthew

        • 1. Re: VBA Scripting for Presenter in PPT?
          robva65 Level 2

          Hey Matthew,

           

          First off, if that were possible, it'd be one hell of a trick....and probably an approach that could make you some money if you developed an app to support it in Presenter.

           

          And although I'd hate to rain on anyone's parade, it goes without saying that testing this sort of thing would be absolutely mandatory....but beyond that, there's one other aspect to this that needs to be addressed.

           

          As far as I can tell, VB code (and objects that use it) are nullified when you go through the publishing process.  I will say this: there was a time (long before we got to the current version of Presenter) that anything using VB would totally fail in the final published content.  I've tried Action Buttons and loosely attempted working with form elements in PowerPoint (both employing simple VB scripting) to enhance what I wanted to do beyond the framework available in Presenter.

           

          Nice try.  No cigar.

           

          That said, I suppose another look at VB coding in PowerPoint is warranted to determine its viability w/ P7.

           

          Rob

           

          http://www.robrode.com/yabb/

          • 2. Re: VBA Scripting for Presenter in PPT?
            mheydman Level 1

            Hi Rob- thanks for the reply.

             

            I think I should have named this topic "Batch Import Videos in Presenter"!

             

            Perhaps I wasn't clear in laying out my thoughts... My apologies... I'm basically looking for a solution to import multiple videos to multiple slides, one-per-slide. If there was a "batch import" feature in Presenter, that would do it, but I don't think it exists (please tell me I'm wrong!)

             

            I was thinking that if Presenter exposed any of its object model via COM that there might be some scripting potential there... IOW, as I am building my presentation, I could run a VB macro in PowerPoint that imported the videos to the slides for me (see my *very* rough coding idea above).

             

            Once this was done there would be no need for the VB code any longer... so it's totally independent of the publishing process.

             

            ----------------------------------

            Thinking aloud:

            It looks as though the videos are converted to FLV's when they are imported. Although I could do the actual conversion to FLV externally, I think the "link" between the slides and the videos is embedded in the PPT file, and so if I developed some sort of workaround for this, I'd have to write directly to the PPT file (binary data?) in order to link the vids to the slides.... which probably isn't a very good idea (unless it's extremely straightforward which I doubt).

             

            I've even considered some sort of mouse-action recording tool to replay the actions necessary to import the video but do not see a way of specifying the desired clip or target slide. However, I could easily import the same video to each slide and then behind the scenes, replace the imported vids with the "correct" vids that I processed separately:

             

            1) Convert my Clip1.avi through Clip50.avi to flv's manually, outside of Presenter.

            2) Import Clip1.avi to all slides - presenter converts them to flv's named somthing like "Clip 01_257_2_22692.flv"

            3) Replace all of the presenter-generated flv's with the flv's I created in step 1 (renaming each one appropriately, which could esily be done via VBScript)

            4) Publish the presentation

             

            And this almost works! The correct videos do indeed play on each slide, but they play for the duration of the originally imported clip (in this example, Clip1.avi) so I would then have to modify the published viewer.xml to change the "StopTime" values for each video... Ugh. Ends up being more trouble than its worth.

             

            I hope this gives a better picture of what I am trying to achieve.

             

            -Matthew

            • 3. Re: VBA Scripting for Presenter in PPT?
              Brom Kim

              I've thought a lot about this one, especially in regards to how much time a designer-developer may spend repetitively clicking, cutting, and pasting.

               

              In my current position, I want to avoid supervising a lot of commoditized monkey work, i.e. manually importing audio or video slide by slide, or manually setting up learning interactions. I definitely don't want to do the 'brain death of a thousand clicks' work myself.

               

              VBA control of Presenter, or XML import of learning interaction fields into Captivate would be really handy, but as there is limited support, I intend to accomplish this via a macro tool, Auto Hotkey (AHK).

               

              The following assumes that lists of files and the like can be dynamically created, in my case from a database the houses course assets. Creating lists of files to process would take time in itself.

               

              1. Record raw AHK macro of adding media to slides
              2. Edit AHK macro, replacing hard coded media paths with variables, and repetitve tasks with loops
              3. Add a section at top of macro to import variable names (of media files) from a .txt file
              4. Export a list of media files to .txt
              5. Run macro, kick back and watch cybermonkey fly through the boring aspects of development:
                1. Import media filenames to variables in AHK
                2. Dynamically attach media to slides
                3. Save finished presentation

               

              The ability to automate such tasks, without delegating should allow one to achieve high productivity, while retaining big picture vision. I'd be pleased to see automation added to the Captivate and Presenter feature sets, as currently exists in InDesign, Photoshop, etc.

               

              I really like Captivate and Presenter output, but if I had to do the repetitive work myself, I would code my own XML-reading Flash and XHTML solutions. The above workaround allows me to skip the wheel reinvention, retaining the handy, pretty, SCORM compliant Captivate/Presenter output.