set WShell = WScript.CreateObject("WScript.Shell")

Dim excel, word, soffice
excel = 0
word = 0
soffice = ""

On Error Resume Next

Rem 8.0 = Office 97
Rem 9.0 = Office 2000
Rem 10.0 = Office XP

nlist = array("8.0", "9.0", "10.0")

for each n in nlist

	str = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\"& n &"\Word\InstallRoot\Path"
	lcValue = WShell.RegRead(str)

	if (lcValue <> "") Then
		word = n
		lcValue = ""
	end if
next

for each n in nlist

	str = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\"& n &"\Excel\InstallRoot\Path"
	lcValue = WShell.RegRead(str)

	if (lcValue <> "") Then
		excel = n
		lcValue = ""
	end if
next

str = "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\soffice.exe\shell\FriendlyCache"
val = WShell.RegRead(str)

if (val <> "") Then
	soffice = val
end if

if (word <> "0") Then
	WScript.StdOut.Write "Word"
end if


if (soffice <> "") Then
	WScript.StdOut.Write "StarOffice"
end if

WScript.quit