Example:
Detecting the operating system

Actions used:

Control Structure - END IF

Control Structure - IF

Page - Jump

In this example, we'll show you how to use built-in variables to determine what operating system the user is running, and then perform different actions (in this case, jumping to different pages) based on that information. If the user is running Windows NT, 2000, or XP, we'll do one thing; if they're running Windows ME we'll do another; and if they're running Windows 95 or Windows 98, we'll do something else.

(You can use this technique to perform any kind of actions that are specific to certain operating systems. Maybe your AutoPlay application is the front end for a CD-ROM containing video card drivers, and you need to install different drivers on NT systems. Or maybe you need to access Registry entries that are found at different locations in 98 and XP. Just put the actions inside IF blocks like we do in this example.)

Here's what the action list looks like:

First, we use a "Control Structure - IF" action to test whether the user is running Windows NT, 2000 or XP. There is a built-in variable for each operating system that is set to "true" if the user is running that operating system, so we just need to test whether any of the variables for those three operating systems are true. We use the OR operator in the expression, so that if any of the variables are true, the whole expression will be true, and the IF block will be performed.

Note that we've split the conditional expression onto three lines. This makes no difference to the outcome of the expression at all, but it can help make the expression a little bit easier to read. In this case, we did it just for the heck of it.

Next, we use a "Page - Jump" action to jump to a page called "NT Start Page", which is what we want this action script to do if the user is running Windows NT, 2000 or XP.

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

The rest of this action list is pretty much the same...use an IF action to test the built-in variables, perform whatever actions you want to perform for that operating system, and then use an END IF action to end the if block.

One part that deserves mention, though, is the last "Page - Jump" action, where we allow for the possibility that our AutoPlay application might be used long enough for Microsoft to release another version of Windows (e.g. Windows.NET) that there isn't currently a built-in variable for. Since Windows XP is the newest operating system at the moment, we just jump to the same start page we used for that.

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)