More black magic
April 6, 1999
by Frank Di Luzio
Starting a PowerPoint Presentation from Director with PowerPoint Viewer 97
I was never a PowerPoint fan before PowerPoint 97. However, many of my presentations ended up being created in Powerpoint because Director didn't offer the chart and text capabilities of the Office programs. Imagine printing out a Director Movie for text corrections? Yuck! Not to mention making overhead transparencies, slides and hand-outs... you get the picture.
Much as we hate to admit it, PowerPoint handles these tasks pretty well. Director comes in handy, though, for hiding the Windows interface and putting a slicker front end on the presentation. For example, I make fancy looking menus and control boards to start the individual PowerPoint presentations. This looks more professional to clients hanging around behind the scenes and is a great way to present a whole batch of individual Powerpoint presentation on a CD-ROM.
Unfortunately, the 97 version of PowerPoint has substantial changes in its architecture which screwed up my standard way of doing things. The cool interface that used to work didn't any more and I had to compile the presentations on a CD-ROM. Now what? The option I've gone with is to launch the PowerPoint presentation outside of Director in the Viewer application that now comes with PowerPoint. Here's how to do it.
Check for the PowerPoint Viewer and install it if need be
First check to see whether ppview32.exe is already installed. My personal experience has shown that it never is, even when the user has the latest PowerPoint version. The magic word here is "Mso97v.dll". If this file doesn't exist in the system folder of Windows then the PowerPoint Viewer 97 was not installed. Here's a way to check for it which makes use of the fileio xtra, so don't forget to include the xtra with your projector.
on CheckforPowerPoint --Check for file under Windows 95 set Win95Path = getOSDirectory() & "\system\" ¬ & "Mso97v.dll" set myfile = new(xtra "fileio") openFile(myFile, Win95Path, 1) if status(myFile) = 0 then set myFile = 0 -- alert "FileFound under Win95" exit end if set myfile = 0 -- Check for file under Windows NT set WinNTPath = getOSDirectory() & "\system32\" ¬ & "Mso97v.dll" set myfile = new(xtra "fileio") openFile(myFile, NTpath, 1) if status(myFile) = 0 then set myFile = 0 -- alert "File Found under NT" exit end if set myfile = 0 alert "This Presentation requires Microsoft PowerPoint ¬ Viewer 97" open the pathname &"PPTview\ppView97.exe" end CheckforPowerPoint
For those of you that use the Buddy API Xtra you can use this code provided by Gary Smith, author of the Buddy API Xtra.
on CheckforPowerPoint set pptViewExe = aReadRegString( "Software\Microsoft\¬ Windows\CurrentVersion\App Paths\ppview32.exe", "", ¬ "", hkey_local_machine" ) if pptViewExe <> "" then if baFileVersion( pptViewExe ) >= 8.0 then alert "PowerPoint 97 installed!" exit end if end if alert "This Presentation requires Microsoft PowerPoint ¬ Viewer 97" end
The last line executes the install program for the PowerPoint Viewer 97 (see end of article for details of where to get it). If you decide to include a deinstall button, just execute the install program again. You also noticed, perhaps, that I used two different methods to search for the Windows System Folder. I did this in case you have problems with machines that have Win95 and NT installed.
To make things easier at run time, put a copy of "ppview32.exe" (plus Msppt8vr.olb and Ppintlv.dll. You can get these out the directory where the ppview32.exe resides) in a directory along with your movie and call it up from there. This avoids having to find it on the host computer. No matter what, PowerPoint Viewer must be installed to work at all.
Do Command to Start a PowerPoint Presentation from Director
In order to launch the particular file in the viewer application, the string we'll be sending from Director will look like this:
Drive:\directory\ppview32.exe ¬ "Drive:\directory\PowerPointPresentation.ppt"
(i.e. D:\PPTview\ppview32.exe "D:\PPTFile\Present.ppt")
Note: The ppview32.exe will not accept long file names or spaces in the file name when sending it a string. Also, always use full paths. The path to the .ppt must be in quotes.
This will start the PowerPoint file without having to pick a file from the viewer UI.
The challenge is designing a way to generate the string in Director so that, in the end, it will send the command to the PowerPoint Viewer with the proper syntax. I really had to fight with Director to make it do this. Nothing seemed to work until I remembered that the do command can execute strings as Lingo commands. I tried it and it worked. You might laugh when you see how I did this. This line of Lingo will go down in Lingo history as having the highest percentage of "quotes" and "&'s" ever. But I assure you, I tried everything not to go down in Lingo history this way. That's why I'll show you a more elegant alternative later.
on CreateDoString --Make a string command to send the -- PPview32.exe and put it into a field put "open the pathname&" & quote & ¬ "directory\ppview32.exe" & quote && " ¬ && quote & the pathname &" & ¬ quote &"directory\Power.ppt""e ¬ into field "Execute" end CreateDoString
Don't laugh too soon! If the name of your .ppt should be inserted by a variable then you'll have to add a few more &'s and quotes. Then you could go down in history.
The previous command puts the following into Field "Execute"
open the pathname & "directory\ppview32.exe" && ¬ quote & the pathname & "directory\Power.ppt"
The Lingo "do" found in the following ShowPowerPoint handler can send the command with the proper syntax
on ShowPowerPoint do the text of member "execute" end ShowPowerPoint
The do command executes the following line which normally does't work:
open "Drive:\directory\ppview32.exe" ¬ "Drive:\directory\Power.ppt"
The second set of quoted text would be ignored using the open command directly. Regardless of how you try to formulate this command line, it will not execute properly.
You could prefabricate many open statements like the one found in field "Execute" above and save them in a field named "Commands". Then you could put line 1 or put line 2 etc. of field "Commands" into member "Execute" like this:
on mouseup put line 3 of field "Commands" into member "Execute". ShowPowerPoint end
Instruction Window
As I mentioned at the beginning, I use Director as a fancy interface to start the various PowerPoint presentations used at a particular event or fair. The fact that the user leaves the Director environment and enters a PowerPoint environment is understandable based on the purpose of this application. Therefore, it's a good idea to inform the user about what is going to happen when he or she starts the PowerPoint Presentation. For instance, let him know how he can exit it, or how he can proceed if it doesn't run automatically but rather per mouse click or keyboard action.
The following script opens the film "InstructionWindow" to demonstrate how this could be done using a MIAW.
on mousedown set the title of window "InstructionWindow" to ¬ "PowerPoint Presents" open window "InstructionWindow" tell window "InstructionWindow" put "To stop the program press esc." into ¬ field "instructions" put "open the pathname&" & quote & ¬ "directory\ppview32.exe" & quote && " ¬ && quote & the pathname &" & ¬ quote & "directory\Power.ppt" & quote ¬ into field "Execute" end tell end
Then, the film "InstructionWindow" could have an "OK" and "Exit" button. The "OK" button script could contain:
on mouseUp do the text of member "execute" end mouseUP
Command-Line Parameters
PowerPoint Viewer supports some command-line parameters too, so you can launch the particular PowerPoint presentation in various play modes. Command lines should be of the following format:
ppview32.exe [command-line switches] ¬ "<path\powerpnt file name>"
The following command-line parameters are supported:
Automatic advance | /A or /a |
Slide range | /R=n-m or /r=n-m where n <= m |
Loop continuously | /L or /l |
/P or /p | |
Macro virus dialog box | /V or /v |
Kiosk mode for file | /K or /k |
You can get the PowerPoint Viewer 97 install program at http://premium.microsoft.com/msdn/library/officedev/office/viewers/viewer32.htm
For another approach to using PowerPoint in Director, read Fred Bals' article.
Copyright 1997-2024, Director Online. Article content copyright by respective authors.