Heather Posted March 8 Share Posted March 8 (edited) For a business project we have to run one script that will detect which office version is installed (O365 or 2016), and then install 32 or 64 bits according to installed office version , detection should be from this path " HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstal", both 32 bits and 64 bits installer are provide. Any suggestion. Edited March 8 by Heather Link to comment Share on other sites More sharing options...
Developers Jos Posted March 8 Developers Share Posted March 8 What did you try that doesn't work as this seems to be pretty straightforward? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Heather Posted March 8 Author Share Posted March 8 (edited) expandcollapse popup;parse uninstall registry value to find installed version of MS office $i = 1 $flag = True $office = "Not installed" While $flag $i = $i + 1 Local $var = RegEnumKey($UninstallReg, $i) If @error = -1 Then ExitLoop If @error = 1 Then ContinueLoop if RegRead($UninstallReg & "\" & $var,"DisplayName") = "Microsoft Office Professional Plus 2016" Then $office = "MS Office Pro 2016" $flag = False ElseIf RegRead($UninstallReg & "\" & $var,"DisplayName") = "Microsoft Office Professional Plus 2013" Then $office = "MS Office Pro 2013" $flag = False Else ContinueLoop EndIf WEnd _FileWriteLog($LogFile_install_mqs, "Step 2 of 3 - Info : MS office installed = " & $office) ;parse unistall x64 registyr key to find installed version of O365 $i = 1 $flag = True $O365 = "Not installed" While $flag $i = $i + 1 Local $var = RegEnumKey($UninstallRegx64, $i) If @error = -1 Then ExitLoop If @error = 1 Then ContinueLoop If StringInStr($var,"O365ProPlusRetail") Then $O365 = $O365 & " - " & $var EndIf WEnd _FileWriteLog($LogFile_install_mqs, "Step 2 of 3 - Info : O365 installed = " & $O365) $InstallFlag = False ;No office installation is found => exit code 10 if $office = "Not installed" And $O365 = "Not installed" then _FileWriteLog($LogFile_install_mqs, "Step 2 of 3 - Error : No office installation is found ... going to exit with return code 10") Exit(10) EndIf ; MS Office Pro 2016 x32 if $office = "MS Office Pro 2016" and $O365 = "Not installed" Then _FileWriteLog($LogFile_install_mqs, "Step 2 of 3 - Info : start installation for MS Office Pro 2016 x32") $InstallFlag = True $result = RunWait($InstallDir & "\AOFFICE28SP12_0-70004974.EXE /Silent") If $result <> 0 Then _FileWriteLog($LogFile_install_mqs, "Step 2 of 3 - Error : installing SAPBusinessAnalysis ... going to exist with return code 9999") DirRemove($InstallDir, 1) Exit(9999) Else _FileWriteLog($LogFile_install_mqs, "Step 2 of 3 - Success : installation SAPBusinessAnalysis finished") EndIf ; O365 x64 if $office = "Not installed" and StringInStr($O365,"O365ProPlusRetail") Then _FileWriteLog($LogFile_install_mqs, "Step 2 of 3 - Info : start installation for O365 X64") $InstallFlag = True $result = RunWait($InstallDir & "\AOFFICE28SP12_0-70004973_X64.EXE /Silent") If $result <> 0 Then _FileWriteLog($LogFile_install_mqs, "Step 2 of 3 - Error : installing SAPBusinessAnalysis failed ... going to exist with return code 9999") DirRemove($InstallDir, 1) Exit(9999) Else _FileWriteLog($LogFile_install_mqs, "Step 2 of 3 - Success : installation SAPBusinessAnalysis finished") EndIf EndIf IF $InstallFlag = False Then _FileWriteLog($LogFile_install_mqs, "Step 2 of 3 - Error : No Installation use case is supported .... going to exist with return code 40") Exit(40) EndIf Edited March 8 by Jos added codebox Link to comment Share on other sites More sharing options...
Developers Jos Posted March 8 Developers Share Posted March 8 (edited) This code isn't valid as there is no EndIf for this line. Also tell is what the issue is with this code! if $office = "MS Office Pro 2016" and $O365 = "Not installed" Then ps: Please use a codebox when you post code. Edited March 8 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Subz Posted March 9 Share Posted March 9 Normally to get the bit type I always check: Reg Key: HKLM\SOFTWARE\Microsoft\Office\16.0\Outlook Reg Value: "Bitness" Reg Data: x86 Reg Key: HKLM64\SOFTWARE\Microsoft\Office\16.0\Outlook Reg Value: "Bitness" Reg Data: x64 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now