? OfficePath
function OfficePath(optional $computer)
dim $regview, $rootkey,$c,$s,$k,$bs[1],$b,$e
dim $officeVersion
$regview = setoption("wow64alternateregview","on")
$rootkey = iif($computer,"\\"+$computer+"\","")+"hklm\software"
$e="0011","011D","0012","0013","0014","002F","008B","002E","0030","0031","0033","0035","00CA"
$bs="","\wow6432node"
$c=0
for each $b in $bs
do
$k = enumkey($rootkey + $b + "\microsoft\windows\currentversion\uninstall",$c)
if right($k,17)="000-0000000FF1CE}"
$s=split($k,"-")[1]
if -1<ascan($e,$s)
$OfficeVersion=split(readvalue($rootkey+$b+"\microsoft\windows\currentversion\uninstall\"+$k,"DisplayVersion"),".")[0]
$OfficePath=readvalue($rootkey+$b+"\microsoft\windows\currentversion\uninstall\"+$k,"InstallLocation") + "Office" + $OfficeVersion
endif
endif
$c=$c+1
until $k="" or $officePath<>""
next
$regview=setoption("wow64alternateregview",$regview)
endfunction