Page 1 of 1 1
Topic Options
#155529 - 2006-01-17 11:22 PM VBScript to Kix Script: MS Word settings
cavilrick Offline
Fresh Scripter

Registered: 2005-11-15
Posts: 7
Loc: Auckland, New Zealand
At login we set the Word 2000 File Locations to point to our local templates directories.

I found some Vbscript code on the internet that does this perfectly. It works in the background without opening Word and is called from the Kix Login Script. However I would prefer to keep the whole login script Kix based.

I am a newbie to Kix and know nothing about VB coding, so I would appreciate any help to convert the VB.

I have no idea how to handle the setting of the 'objoptions'.

Any help appreciated.

VBscript:
On Error Resume Next

Const wdUserTemplatesPath = 2
Const wdWorkgroupTemplatesPath = 3
Const wdAutoRecoverPath = 5
Const wdStartUpPath = 7

Set objWord = CreateObject("Word.Application")
Set objOptions = objWord.Options
objOptions.DefaultFilePath(wdUserTemplatesPath) = "C:\UTemplates"
objOptions.DefaultFilePath(wdWorkgroupTemplatesPath) = "C:\WTemplates"
objOptions.DefaultFilePath(wdAutoRecoverPath) = "C:\AutoRecover"
objOptions.DefaultFilePath(wdStartUpPath) = "C:\StartUp"

objWord.Quit

Top
#155530 - 2006-01-18 12:09 AM Re: VBScript to Kix Script: MS Word settings
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Well - got some bad news for you. If what you were trying to do was actually supported in Kixtart - your script would have look like this:

Code:

Break On

$wdUserTemplatesPath = 2
$wdWorkgroupTemplatesPath = 3
$wdAutoRecoverPath = 5
$wdStartUpPath = 7

$objWord = CreateObject("Word.Application")
$objOptions = $objWord.Options

$objOptions.DefaultFilePath($wdUserTemplatesPath) = "C:\UTemplates"
$objOptions.DefaultFilePath($wdWorkgroupTemplatesPath) = "C:\WTemplates"
$objOptions.DefaultFilePath($wdAutoRecoverPath) = "C:\AutoRecover"
$objOptions.DefaultFilePath($wdStartUpPath) = "C:\StartUp"

$objWord.Quit
$objWord = 0

Exit 0



BUT - unfortunately, this line here:

$objOptions.DefaultFilePath($wdUserTemplatesPath) = "C:\UTemplates"

and the other three lines below it ARE NOT supported by Kixtart. In Kixtart, you cant write to a property that has arguments. You can only read them. We've been down this road with the Developer - and he has stated that implementing support for this will not be possible.

So - unless you can find another PROPERTY or METHOD that does what you want it to do - think you'll have to stick with VBS for this small bit.

Top
#155531 - 2006-01-18 07:58 PM Re: VBScript to Kix Script: MS Word settings
cavilrick Offline
Fresh Scripter

Registered: 2005-11-15
Posts: 7
Loc: Auckland, New Zealand
Unfortunate, thanks for answering the query.
Top
#155532 - 2006-01-18 08:11 PM Re: VBScript to Kix Script: MS Word settings
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
however, look here:
HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\General
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
2 registered (morganw, mole) and 414 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.05 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org