Zeus Productions Banner

Zeus Tech Note
Determining the Playback Platform

(This document last revised July 10, 1997)

Copyright © 1996-1997. Zeus Productions. All Rights Reserved.
Written by Bruce A. Epstein

Relevant Lingo Commands:

the platform (Director 5.0 and higher)
the machineType

Relevant Xtras:

zWinVer



Q. Why would I need to know the playback platform at Run-Time?

A. Ideally, you would like to run the exact same Director presentation on all platforms. In practice, this is not always possible, due to platform-specific items such as Xtras ond XObjects. Furthermore you may not intend to support all platforms, and want to warn the user if they inadvertently try to play your PowerMac-only presentation on a Standard Macintosh, or your Windows 95-only product under Windows 3.1 or NT.


Q. How do I determine the playback platform at Run-Time?

A. Let's be clear on what we mean by the "playback platform". On the most basic level, we want to distinguish between Macintosh and Windows PCs. This is done using Lingo's the machineType command. But the machineType only determines the hardware (whether you are running on a Macintosh or a PC), not the Windows OS version, nor the processor type.

Lingo's the machineType command returns the value 256 for all IBM-PC compatible (non-Macintosh) computers. Director 5.0 introduced the platform command does not return the true platform on which a projector is running, it simply returns the type of projector being executed. It does not accurately determine the Windows OS version or Mac processor type.

Via Lingo alone, it is impossible to determine if a 16-bit projector is running under Windows 3.1 or under Windows 95. Likewise, Lingo can not distinguish between a 32-bit projector under Windows 95 or Windows NT. Zeus's zWinVer Xtra always returns the true Windows OS version regardless of the Projector type.


Q. How do I distinguish between Macs and PCs at Run-Time?

A. Lingo's the machineType returns 256 for IBM-compatible computers, and a number other than 256 for Macintosh models. (Note, all Mac models were previously less than 256, but some now retrun codes greater than 256). The codes it returns may not be highly reliable, as some users change their processors. Therefore, you should use the platform command instead. Zeus offers utilities to determine the true processor and other information about the Macintosh model.

On approach is to use the checkPlatform handler below once to determine whether you are on a Mac or PC, and then use a global variable (gMacPlatform) to branch accordingly.
	on checkPlatform
		global gMacPlatform

		if the platform starts "Windows" then
		  set gMacPlatform = FALSE 
		else 
		  set gMacPlatform = TRUE 
		end if

	end checkPlatform 


	on someHandler
		global gMacPlatform

		checkPlatform()

		if gMacPlatform = TRUE then 
		  -- Do some Mac-specific stuff 
		else 
		  -- Do some PC-specific stuff 
		end if

	end someHandler
Here is an alternative without using a global variable. This will be a little slower if you have to check repeatedly for some reason.

	on onPC
	  if the platform starts "Windows" then
	    return TRUE
	  else
	    return FALSE
	  end if
	end onPC


	-- check if we are on a Mac or not
	on onMac
	  if the platform starts "Mac" then
	    return TRUE
	  else
	    return FALSE
	  end if
	end onMac

	on someHandler

		if onMac() then 
		  -- Do some Mac-specific stuff 
		else 
		  -- Do some PC-specific stuff 
		end if

	end someHandler

Q. How do I determine the Windows OS version at Run-Time?

A. The most reliable method of checking the Windows OS version is Zeus zWinVer Xtra. Lingo's "the platform" does NOT return the true Windows OS version, it returns whether the PROJECTOR is 16-bit or 32-bit.

Warning: Lingo's the platform returns "Windows,16" when running a 16-bit projector under Windows 95, not "Windows,32" as you might expect. Use the zWinVer Xtra from Zeus Productions to determine the OS accurately.

In Director 4.0, there is no built-in way to determine the Windows platform without the zWinVer XObject. For Director 5.0 and 6.0, if you can guarantee that your users will always be running only a 32-bit projector under Windows 95, then you can reliably use "the platform". Otherwise, inquire about the zWinVer Xtra, which reliably returns the Windows OS version.

Q. How do I make sure my users start the correct Windows Projector (16-bit or 32-bit)?

A. You can exercise one of several options:

Q. How do I determine the Mac Processor Type (68K or PowerPC) at Run-Time?

A. There is no built-in Lingo to determine the Macintosh processor type. Lingo's the machineType command will indicate the Macintosh model, but it is unreliable when users upgrade their processors, and it is difficult to keep the list of Macintosh models up to date. The easiest approach is to build a Fat Binary Projector, and then use Lingo's the platform command to determine the processor type. Some third party utilities may indicate whether the processor is a PowerPC.



Home (Spotlight) | Table of Contents | Links | Contact Info

Place an Order | Products for Sale | Licensing | Downloads

TechNotes | FAQs | E-Mail Zeus | GuestBook | Glossary

[End of Page]

Copyright © 1996-1997. Zeus Productions. All Rights Reserved.