storme Posted April 9, 2010 Share Posted April 9, 2010 G'day allI use Autopatcherto update computers when I have to bring them back to the office for repairs.To keep everything clean I've seperated the the Operating systems and Office verions into seperate directories.I've got the selection of the Operating system (XP/Vista 32/64 SP?) setup.What I can't work out is an easy way to work out what version of Office (XP, 2003, 2007) is loaded on the system.Anyone point me in the right direction?Thanks in advanceJohn Morrison Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
Spiff59 Posted April 9, 2010 Share Posted April 9, 2010 (edited) G'day allI use Autopatcherto update computers when I have to bring them back to the office for repairs.To keep everything clean I've seperated the the Operating systems and Office verions into seperate directories.I've got the selection of the Operating system (XP/Vista 32/64 SP?) setup.What I can't work out is an easy way to work out what version of Office (XP, 2003, 2007) is loaded on the system.Anyone point me in the right direction?Thanks in advanceJohn MorrisonThe function _Word_VersionInfo() in the Word.au3 UDF might be of use.I think it's a safe assumption that any MS Office installation will at least include MS Word. Edited April 9, 2010 by Spiff59 Link to comment Share on other sites More sharing options...
storme Posted April 9, 2010 Author Share Posted April 9, 2010 The function _Word_VersionInfo() in the Word.au3 UDF might be of use. I think it's a safe assumption that any MS Office installation will at least include MS Word. Looks like that only returns the version of the UDF Returns an array of information about the Word.au3 version I ran the test code #include <Word.au3> $aVersion = _Word_VersionInfo () ConsoleWrite("Word.au3 Version " & $aVersion[5] & " released " & $aVersion[4]) and it gave me this Word.au3 Version V1.0-1 released 20070414 Thanks for the help and it was a great bit of lateral thinking. Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
Spiff59 Posted April 9, 2010 Share Posted April 9, 2010 (edited) Looks like that only returns the version of the UDF I ran the test code #include <Word.au3> $aVersion = _Word_VersionInfo () ConsoleWrite("Word.au3 Version " & $aVersion[5] & " released " & $aVersion[4]) and it gave me this Thanks for the help and it was a great bit of lateral thinking. Wow, that's not at all what I'd of thought _Word_VersionInfo does. Not a very useful function. This seems to work: $objWord = ObjCreate("Word.Application") MsgBox(1,"", $objWord.Version & " or " & $objWord.Build) ; short and long version info $objWord.Quit Edit: Of course an "If IsObj($ObjWord)" test after the ObjCreate might be prudent in case you run into machines where Word/Office haven't been installed. Edited April 9, 2010 by Spiff59 Link to comment Share on other sites More sharing options...
storme Posted April 9, 2010 Author Share Posted April 9, 2010 Wow, that's not at all what I'd of thought _Word_VersionInfo does. Not a very useful function. This seems to work: $objWord = ObjCreate("Word.Application") MsgBox(1,"", $objWord.Version & " or " & $objWord.Build) ; short and long version info $objWord.Quit THANKS HEAPS!!! That is exactly what I needed. I did a little extra research and found what the numbers mean so maybe someone will find this usefull. $objWord = ObjCreate("Word.Application") $OfficeVerison = $objWord.Version $objWord.Quit Switch $OfficeVerison Case "7.0" $OfficeVerison = "97" Case "8.0" $OfficeVerison = "98" Case "9.0" $OfficeVerison = "2000" Case "10.0" $OfficeVerison = "2002" Case "11.0" $OfficeVerison = "2003" Case "12.0" $OfficeVerison = "2007" Case "14.0" $OfficeVerison = "2010" Case Else $OfficeVerison = "Too Old!" EndSwitch MsgBox(0,"Office Verison", "Your office Verison is " & $OfficeVerison) As you siad Word is always part of office so look for the "tree" and we know what "forest" we're in. Thanks Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
Spiff59 Posted April 9, 2010 Share Posted April 9, 2010 (edited) THANKS HEAPS!!! That is exactly what I needed. I did a little extra research and found what the numbers mean so maybe someone will find this usefull. $objWord = ObjCreate("Word.Application") $OfficeVerison = $objWord.Version $objWord.Quit Switch $OfficeVerison Case "7.0" $OfficeVerison = "97" Case "8.0" $OfficeVerison = "98" Case "9.0" $OfficeVerison = "2000" Case "10.0" $OfficeVerison = "2002" Case "11.0" $OfficeVerison = "2003" Case "12.0" $OfficeVerison = "2007" Case "14.0" $OfficeVerison = "2010" Case Else $OfficeVerison = "Too Old!" EndSwitch MsgBox(0,"Office Verison", "Your office Verison is " & $OfficeVerison) As you siad Word is always part of office so look for the "tree" and we know what "forest" we're in. Thanks You're welcome. What? Microsoft is superstitious? They skipped version 13? lol I think the script might explode if you run across a machine with no version of Word installed, you might want to test if the ObjCreate() worked, soemthing like: $objWord = ObjCreate("Word.Application") If IsObj($objWord) Then $OfficeVerison = $objWord.Version $objWord.Quit Else $OfficeVerison = "N/A" EndIf Switch $OfficeVerison Case "7.0" $OfficeVerison = "97" Case "8.0" $OfficeVerison = "98" Case "9.0" $OfficeVerison = "2000" Case "10.0" $OfficeVerison = "2002" Case "11.0" $OfficeVerison = "2003" Case "12.0" $OfficeVerison = "2007" Case "14.0" $OfficeVerison = "2010" Case "N/A" $OfficeVerison = "Not Installed" Case Else $OfficeVerison = "Too Old!" EndSwitch MsgBox(0,"Office Verison", "Your office Verison is: " & $OfficeVerison) You prolly wanna replace all the "verison" with "version" as well Edited April 9, 2010 by Spiff59 Link to comment Share on other sites More sharing options...
storme Posted April 9, 2010 Author Share Posted April 9, 2010 Thanks again. I was going to add the error checking when I added the rest of the code to do the updates (tomorrow). But it's easier to just cut and paste yours. When I get teh script beat into shape I'll drop it into the example forum. Someone may find it usefull. Have a great weekend! Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E 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