I got some mess of a code which definately is a work in progress but here is the code.


Dim oldzensourcepath
Dim zensourcepath
Dim Shell
Dim FSO
Dim ErrorSource
Dim Key
Dim Code

Rem Set up the WshShell object
Set Shell = CreateObject("wscript.shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
oldzensourcepath = "\\cnrlfs05\vol10\ZENWORKS\Win2k"

On Error Resume Next
Rem Set the application name for error reporting purposes.
ErrorSource = "ZENSOURCEPATH MSI Change Utilitiy"
Key = "HKLM\Software\CNRL\" & Errorsource
Code = "0"


If err.number <> 0 Then
Shell.RegWrite Key & "\Code", err.number
Shell.RegWrite Key & "\Error Message", err.description
Quit
End If

CheckFilePath

Sub CheckFilePath
On Error Resume Next
If FSO.FileExists("c:\temp\zensp.txt") Then
READFILE
Else
Err.raise "6029", ErrorSource, "ZENSOURCEPATH File not Found!"
Shell.RegWrite Key & "\Code", err.number
Shell.RegWrite Key & "\Error Message", err.description
Quit
End If
End Sub

Sub READFILE
On Error Resume Next
Dim fso, f1, ts, zensourcepath
Set fso = CreateObject("Scripting.FileSystemObject")
Const ForReading = 1
' Read the contents of the file.
WScript.Echo "Reading file <br>"
Set ts = fso.OpenTextFile("c:\temp\zensp.txt", ForReading)
zensourcepath = ts.ReadLine
WScript.Echo "File contents = '" & zensourcepath & "'"
ts.Close
If err.number <> 0 Then
Shell.RegWrite Key & "\Code", err.number
Shell.RegWrite Key & "\Error Message", err.description
Quit
End If

WScript.Echo "File contents = '" & zensourcepath & "'"
Set msiObject = WScript.CreateObject("WindowsInstaller.Installer")
Set MsiConfig = WScript.CreateObject("Scripting.Dictionary")
MsiConfig.Add "{505AFDC0-5E72-4928-8368-5DEA385E3647}", zensourcepath & "\CorelDRAW 12\"
MSIKeys = MsiConfig.Keys
MSIItems = MsiConfig.Items

For Each strkey In MSIKeys
WScript.Echo strkey
WScript.Echo "'" & stritem & "'"
msiObject.ClearSourceList strkey, ""
msiObject.AddSource strkey, "", stritem
Next




So if we look at the following code stritem is blank. Can anybody tell me why?


WScript.Echo "File contents = '" & zensourcepath & "'"
Set msiObject = WScript.CreateObject("WindowsInstaller.Installer")
Set MsiConfig = WScript.CreateObject("Scripting.Dictionary")
MsiConfig.Add "{505AFDC0-5E72-4928-8368-5DEA385E3647}", zensourcepath & "\CorelDRAW 12\"
MSIKeys = MsiConfig.Keys
MSIItems = MsiConfig.Items

For Each strkey In MSIKeys
WScript.Echo strkey
WScript.Echo "'" & stritem & "'"
msiObject.ClearSourceList strkey, ""
msiObject.AddSource strkey, "", stritem
Next
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
I'm not sure I've understood what you're asking, but if I have the try replacing this line:

WScript.Echo "'" & stritem & "'"

With this line:

WScript.Echo "'" & MsiConfig.Item(strkey) & "'"

Hope this is useful?
Answered 03/25/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment
0
Thanks, that is exactly what I needed to know.
Answered 03/28/2005 by: kkaminsk
Ninth Degree Black Belt

Please log in to comment
Answer this question or Comment on this question for clarity