Archive: Word Global Templates


Word Global Templates
I am trying to write an installation for a Word global template. This means copying a file to the Word startup area. The Word startup area is either default or defined in the registry, but the registry name depends on the version of Word and to get the Word version reliably requires running Word. This shell script will display the version:

Set objWord = CreateObject("Word.Application")
Set objOptions = objWord.Options
Wscript.Echo "Version: " & objWord.Version
objWord.Quit

but I can't work out how to call it and get the value of objWord.Version back into NSIS.
I could pass it back as an result code, but that will only allow an integer and the value will be something like "11.0".
I thought maybe I should write it to a file and then read the file from within NSIS, but it looks tricky working out where to write the file. Is that the right way to go?
Any nudge in the right direction would be appreciated.
J.


Use nsExec::ExecToStack with `"$SYSDIR\wscript.exe" "path\to\file.vbs"` (notice the double quotes) and then Pop $R0.

Stu


I will look into that - thanks


no need to call a external script, you can call COM objects with the system plugin, the system plugin readme has a COM example


Isn't $TEMPLATES good enough?


Isn't $TEMPLATES good enough?
No, 'fraid not.
Word has three template areas - user templates (which probably defaults to $TEMPLATES), group templates and global templates (which is the Word Startup area). Global templates get different security privileges to the others, so is the one to use if you need to include toolbars with the template.

All of these template areas can be overridden in Word by the user, in which case their new values are held in the registry.

In addition, you can have more than one version of Word installed on a machine - I have 2003 and 2007 - perhaps one might be a demo version or you might have multiple versions for testing software.

So I have 6 potential different template areas, and, as I said, the registry keys depend on the version of Word.
I did think that I could simply ask Word what it value for Startup was, but that gives another value altogether!

I have now successfully coded it up using nsExec