Break On
If @onwow64 = 1
$SearchKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Common\InstalledPackages"
Else
$SearchKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
EndIf
$RegArray = SearchReg($SearchKey,"Outlook",7)
If @Error
? 'No matching items found'
Else
For Each $value in $RegArray
? $value
$x = Join(Split($value, $SearchKey + "\"), "")
If SubStr($x, 1, 1) = 9
? "office found"
If SubStr($x, 20, 1) = 1
? "Office 64Bit found"
$OfficeBit = 64
Else
? "Office 32Bit found"
$OfficeBit = 32
EndIf
EndIf
Next
EndIf
? Get $x
Exit
;;
;;======================================================================
;;
;;FUNCTION SearchReg()
;;
;;ACTION Searches a specific registry path for a value
;;
;;AUTHOR Allen Powell
;; Adapted, formatted, & documented by Glenn Barnas
;;
;;VERSION 1.0 / 2014/01/11
;;
;;SYNTAX SearchReg(Key, String, Search)
;;
;;PARAMETERS Key - Required -
;;
;; String - Required -
;;
;; Search - Required -
;;
;; 1 For Value
;; 2 for ValueName
;; 3 for Value and ValueName
;; 4 for KeyName
;; 5 for Value and KeyName
;; 6 for ValueName and KeyName
;; 7 for search in all
;;
;;Remarks:
;; KiXtart reads and writes default ValueNames as an empty string.
;; SearchReg() replaces the empty ValueName with the text: <Default>
;; Remember to replace the text '<Default>' with an empty string if you want to check
;; the found entries further.
;;
;;RETURNS
;;
;; Array containing values where SearchFor string was found.
;; arraymember format is:
;; KeyName<=>ValueName
;; (If the Searchstring is found in the KeyName, ValueName is set to <KeyName>
;;
;; Errors returned:
;; @Error 1 = No data returned from search
;;
;;
;;DEPENDENCIES none
;;
;;TESTED WITH WXP, W2K3, W2K8, W2K12, Win7, Win8
;;
;;KiXtart:
;; KiX 4.20
;;
;;Example:
;; Break On
;; $RegArray = SearchReg("HKEY_LOCAL_MACHINE\Software\Microsoft","dir",7)
;; If @Error
;; ? 'No matching items found'
;; Else
;; For Each $value In $RegArray
;; ? $value
;; Next
;; EndIf
;; ? Get $x
;;
;;
;;Source:
Function SearchReg($_Key, $_Str, $_SrcIn)
Dim $_Idx
Dim $_vName
Dim $_Value
Dim $_Num
Dim $_SubKey
Dim $_fArr
Dim $_mbr
$SearchReg = ''
$_Num = 0
$_Idx = 0
$_vName = EnumValue($_Key, $_Idx)
Do
$_mbr = ''
If $_SrcIn & 1
$_Value = ReadValue($_Key, $_vName)
If InStr($_Value, $_Str)
$_mbr = $_Key + "<=>" + IIf($_vName, $_vName, '<Default>')
EndIf
EndIf
If ($_SrcIn & 2) And InStr($_vName, $_Str)
$_mbr = $_Key + "<=>" + $_vName
EndIf
If $_mbr
ReDim Preserve $SearchReg[$_Num]
$SearchReg[$_Num] = $_mbr
$_Num = $_Num + 1
EndIf
$_Idx = $_Idx + 1
$_vName = EnumValue($_Key, $_Idx)
Until @Error
$_Idx = 0
$_SubKey = EnumKey($_Key, $_Idx)
While $_SubKey
If ($_SrcIn & 4) And InStr($_SubKey, $_Str)
ReDim Preserve $SearchReg[$_Num]
$SearchReg[$_Num] = $_Key + '\' + $_SubKey + "<=><KeyName>"
$_Num = $_Num + 1
EndIf
$_fArr = SearchReg($_Key + "\" + $_SubKey, $_Str, $_SrcIn)
If @Error = 0
For Each $_mbr in $_fArr
ReDim Preserve $SearchReg[$_Num]
$SearchReg[$_Num] = $_mbr
$_Num = $_Num + 1
Next
EndIf
$_Idx = $_Idx + 1
$_SubKey = EnumKey($_Key, $_Idx)
Loop
Exit VarType($SearchReg) = 8
EndFunction