Example:
Running a PowerPoint presentation

Actions used:

Control Structure - END IF

Control Structure - IF

File - Execute

File - Get Default Viewer

Variable - Set Value

In this example, we'll run a PowerPoint presentation after checking to see if the user has a PowerPoint viewer installed. If they don't, we'll use a viewer that we've included on the same CD-ROM that our AutoPlay application is running from.

Here's what the action list looks like:

First, we use a "File - Get Default Viewer" action to get the user's default viewer for PowerPoint files, if they have one. If they do, the full path to it will be stored in a variable called %PowerPointViewer%.

This action will generate an error if it fails. Since we'll be handling that ourselves, we don't need the user to be told about the error, so we'll change the User Notification settings on the On Error tab for this action from "Verbose" to "None".

Next, we use a "Control Structure - IF" action to test whether the "File - Get Default Viewer" action failed. If the action was successful, %LastErrorNum% will be 0, so we use a != operator to create an expression that will be true if %LastErrorNum% is not 0.

If the "File - Get Default Viewer" failed, then the user probably doesn't have a PowerPoint viewer installed...in which case, we use a "Variable - Set Value" action to put the full path of the viewer on the CD-ROM into %PowerPointViewer%.

Then we use a "Control Structure - END IF" to end our IF block.

Finally, we use a "File - Execute" action to run the PowerPoint viewer (either the user's own, or the one on the CD) and pass it the path to our presentation as a command line argument. In order to make our AutoPlay application wait for the user to close the viewer before continuing, we've enabled the Wait for program to finish before continuing option.

Note that we've surrounded the command line arguments in quotation marks because our filename has spaces in it.

Here's a link to the finished example, as an AutoPlay Media Studio 4.0 actions XML file that you can import into an action list:

(Note: save this file to your hard drive and use a tool like WinZip to extract the XML file)