[Office] Get office version Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
mINXZKA
Posts: 11
Joined: 16 Mar 2016, 03:47

[Office] Get office version

17 Feb 2017, 09:58

Hey all,

is there a way to get the installed office version (outlook / excel / word / whatever...) with DllCalls and / or with COM object? (no registry)
Last edited by mINXZKA on 30 Mar 2017, 08:56, edited 1 time in total.
User avatar
Spawnova
Posts: 530
Joined: 08 Jul 2015, 00:12
GitHub: Spawnova
Contact:

Re: Get Office Version

17 Feb 2017, 10:25

I'm not sure about com/dllcall but there is an xml file in the office folder which I believe holds the office version.

Code: Select all

officeDir := "C:\Program Files (x86)\Microsoft Office\"
filePath := officedir "AppXManifest.xml"
ifexist,% filePath
{
	fileread,output,% filepath
	RegExMatch(output,"Version=\x22(.+?)\x22",version)
	msgbox % "Version: " version1
	
} else msgbox file not found
exitapp
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Get Office Version

17 Feb 2017, 15:01

I was just about to post and I noticed you said 'no registry', so I hope you and others find this interesting/useful nonetheless. (You could check the start menu shortcuts if it mustn't be by the registry.)

This method uses the registry to get the path, from one of the sources that the 'Run' command would use, and then gets the version number from the exe file:

Code: Select all

q::
vList := "chrome.exe,firefox.exe,iexplore.exe,excel.exe"
vOutput := ""
Loop, Parse, vList, % ","
{
	RegRead, vPath, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\%A_LoopField%
	FileGetVersion, vPVersion, % vPath
	vOutput .= vPVersion "`t" vPath "`r`n"
}
Clipboard := vOutput
MsgBox, % "done"
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask For Help”

Who is online

Users browsing this forum: andrict05, ECASNIPER118, Google [Bot], mikeyww, tatagi, teadrinker and 45 guests