/build/static/layout/Breadcrumb_cap_w.png

MSI error 1720

When I try to use Call VBScript From Property CA by embedding following VB script (see bellow) in a property I get MSI error 1720 : There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor.

Dim objWSH, objFSO, DIRS
Dim RUNPATH, SYS32
Dim HOSTSFILE, TEXTFILE
Dim OLDLINE, LINEARRAY, IPLEN, NEWLINE, i, x, SPACES
Const ForReading = 1
Const ForAppending = 8
Set objWSH = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
RUNPATH = ("D:\Programs\Telemecanique\FactoryLink\")
SYS32 = objWSH.ExpandEnvironmentStrings("%SYSTEMROOT%")
Set HOSTSFILE = objFSO.OpenTextFile(SYS32 & "\System32\Drivers\etc\hosts", ForAppending)
Set TEXTFILE = objFSO.OpenTextFile(RUNPATH & "hosts.txt", ForReading)
Do Until TEXTFILE.AtEndOfStream
OLDLINE = TEXTFILE.ReadLine
LINEARRAY = Split(OLDLINE, "|")
IPLEN = LEN(LINEARRAY(0))
Select Case IPLEN
Case 15 x = 1
Case 14 x = 2
Case 13 x = 3
Case 12 x = 4
Case 11 x = 5
Case 10 x = 6
Case 9 x = 7
Case 8 x = 8
Case Else x = 9
End Select
For i = 1 to x
SPACES = SPACES & " "
Next
NEWLINE = LINEARRAY(0) & SPACES & LINEARRAY(1) & " " & LINEARRAY(2)
HOSTSFILE.WriteLine NEWLINE
OLDLINE = Null
LINEARRAY = Null
NEWFILE = Null
x = Null
SPACES = Null
Loop
HOSTSFILE.Close
TEXTFILE.Close

Any ideas about what could be wrong here?

If I run this VB Script directly by using execute program from destination by example, everything goes fine, so it shouldn't be an error in the script..

Any idea is appriciated!

Thanks, Aleksandar

0 Comments   [ + ] Show comments

Answers (4)

Posted by: anonymous_9363 15 years ago
Red Belt
0
Firstly, you'll want to use the 'code' tag to post code next time, as that inserts a scrollable textarea which is much easier to read. Additionally, it preserves any formatting you may have used.

I haven't tested my theory but I suspect that, because Windows Installer uses its own VBS interpreter and not the Windows Scripting Host engine, the script is choking where you set the variables to 'Null'. Use an empty string instead or, simply don't bother: the values are reset every time the variable is used in the loop.

Next, your 'padding' code could be simplified by using TAB (vbTAB or Chr(9)), or like this:Do Until TEXTFILE.AtEndOfStream
OLDLINE = TEXTFILE.ReadLine
LINEARRAY = Split(OLDLINE, "|")
IPLEN = LEN(LINEARRAY(0))

If IPLEN < 8 Then
SPACES = String(9, " ")
Else
SPACES = String((16-IPLEN), " ")
End If

NEWLINE = LINEARRAY(0) & SPACES & LINEARRAY(1) & " " & LINEARRAY(2)
HOSTSFILE.WriteLine NEWLINE
OLDLINE = ""
LINEARRAY = ""
NEWFILE = ""
x = ""
SPACES = ""
Loop

Lastly, the post probably ought to have been posted in the 'Scripting' forum http://www.appdeploy.com/messageboards/tt.asp?forumid=6&bcsi_scan_DEA2E070FBFB2D7A=BXhEYBb2a1ta6y5gWIAi6AEAAADDZgMA&bcsi_scan_filename=tt.asp
Posted by: Aleksandar 15 years ago
Senior Yellow Belt
0
Thanks for your comments VBScab.
These things can happens if you are attending this forum for the first time. I shall try to pay more attention to that next time. [:)]

For what concerns my matter and your advice, I have try to empty "Null" variables and I have edited my script with your code but still the script won't run..

[8|] Have you more suggestions?
Posted by: anonymous_9363 15 years ago
Red Belt
0
ORIGINAL: Aleksandar
When I try to use Call VBScript From Property CA by embedding following VB script (see bellow) in a property
I've onlu *just* noticed that you are running the script from a Property. That's not an option I've ever used, to be honest. I've only ever used Embedded, From Installation or From Installed Files and normally only the first two.

With Embedded, you need to be aware that there is a documented limit to the number of characters (256 characters? I can't recall...). The *current* engine doesn't enforce that limit, however, but I'd advise caution in embedding larger scripts, given that Microsoft may choose to enforce the limit in future versions.

With From Installation and From Installed Files, you have no built-in access to the session's properties so you'd need to pass data to the script if you need that access.

Try switching your script to one of these alternatives and see what happens.
Posted by: Aleksandar 15 years ago
Senior Yellow Belt
0
OK.
I have try to use this script in the combination with Embedded function and it has worked.
Thanks again.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ