I have a vbscript that runs during install to overwrite an existing file based on a condition. It works fine if I don't have any spaces in the path such as C:\windows\newfile.txt but if I want to use C:\Documents and Settings\All Users\Application Data\OrderPad it will fail with a path error. Using 8.3 short names seems like a kludge fix and while it does actually work I still get the following errors in the windows installer log. Using CA type 70.

Log file

Doing action: ConnPF
Action ended 11:54:06: InstallExecute. Return value 1.
MSI (s) (D0:64) [11:54:06:078]: Transforming table CustomAction.

MSI (s) (D0:64) [11:54:06:078]: Transforming table Binary.

MSI (s) (D0:8C) [11:54:06:090]: Note: 1: 1720
Action start 11:54:06: ConnPF.
Info 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. Custom action script error , : Line , Column ,



VBscript

'Create a text file

DIM fso, ConnFile

Set fso = CreateObject("Scripting.FileSystemObject")
Set ConnFile = fso.CreateTextFile("C:\Documents and Settings\All Users\Application Data\OrderPad\OrderPad.exe.conn", True)
ConnFile.WriteLine "<?xml version=""1.0"" encoding=""utf-8""?>"
ConnFile.Write "<connection name=""LOCAL"" prompt=""False"" dataModified=""False"" />"
ConnFile.Close
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
Changed the script from a file in the binary table to the custom action table and set the type to 3110. Now it works without any errors although I would like to know what the correct formatting should be in the script to allow long names.
Answered 02/23/2011 by: joedown
Second Degree Brown Belt

Please log in to comment
0
You should be able to do this:
Dim fso, ConnFile, folder

Set fso = CreateObject("Scripting.FileSystemObject")

Set folder = fso.GetFolder("C:\Documents and Settings\All Users\Application Data\OrderPad\")

Set ConnFile = folder.CreateTextFile("OrderPad.exe.conn")

ConnFile.WriteLine "<?xml version=""1.0"" encoding=""utf-8""?>"
ConnFile.Write "<connection name=""LOCAL"" prompt=""False"" dataModified=""False"" />"
ConnFile.Close

Set fso = Nothing
Set folder = Nothing
Set Connfile = Nothing


but in any case, you need to check the 'OrderPad' folder exists first, and rather than hard coding the path use environment variables etc.....
Answered 02/23/2011 by: captain_planet
Second Degree Brown Belt

Please log in to comment
0
Thanks! That worked great although I don't really understand why getting the folder works?
Answered 02/23/2011 by: joedown
Second Degree Brown Belt

Please log in to comment
0
Nice one, Cap'n. I've learned something today :-)

Joe, FFR, there is a dedicated 'Scripting' forum on AppDeploy.
Answered 02/24/2011 by: VBScab
Red Belt

Please log in to comment
0
ORIGINAL: joedown

I don't really understand why getting the folder works?
- errrm (cough)....neither do I.....[&:]

ORIGINAL: VBScab

I've learned something today :-)
- Ha. I'm not sure whether to interpret that as sarcasm, but if not, you're welcome. [;)]
Answered 02/24/2011 by: captain_planet
Second Degree Brown Belt

Please log in to comment
0
For a change, the [sarcasm] tag remains unused. I genuinely didn't know that that was a valid construct.
Answered 02/24/2011 by: VBScab
Red Belt

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