akundi
Posts: 5
Joined: Fri Sep 02, 2005 1:00 pm

using xml

Hi,
I want to read an xml file and create the registry entries aswell as the folder structure during installation. I am using a vbscript custom action .
here is the code I am trying to execute..

Set xmlDoc = WScript.CreateObject ("Microsoft.XMLDOM")

xmlDoc.async=false
strfname=Session.Property("SourceDir")& "\PassSaver.xml"
xmlDoc.load(strfname)
PathKey = "HKCU\Software\MyKey"

Set l = xmlDoc.documentElement.childNodes.item(1).childNodes
for i=1 to l.length
...
....


This code works outside the advanced installer. when I attach the vbs file , the code stops when trying to load the xml file.

any suggestions?

Regards
akundi
Mike
Posts: 292
Joined: Wed Jun 01, 2005 10:50 am
Location: Craiova, Romania
Contact: Website

Hi,

I would say there are two possible problems in this code:

1. The SourceDir is not available before the "ProcessComponents" standard action. Also, it is not available during the uninstall of the application. So, when testing your custom action you could insert a MsgBox there to check if the actual value of the property is the one expected (or is blank). If necessary, change the location of the custom action.

2. The SourceDir has a value ending with the backslash character ("\").
E.g. "c:\folder\". You are adding the string "\PassSaver.xml".
The strfname variable will then have a value like "c:\folder\\PassSaver.xml". This, of course, doesn't work.

Again, a suggestion would be to have a MsgBox to find out the value of strfname.

Hope this helps.

Regards,
Mihai
Mihai Bobaru
Advanced Installer Team
http://www.advancedinstaller.com
akundi
Posts: 5
Joined: Fri Sep 02, 2005 1:00 pm

I got the error and corrected. Now I can load the xml file but not able to read the elements. In the xml file I was reading, there is an element with 4 items. When I execute the script returns 0. The vbscript file used for this purpose works outside the Advanced Installer. That is when I execute wscript test2.vbs at the command prompt and the return value is 4.

I had even tried a inline script with fourlines of the code. does not work.
Mike
Posts: 292
Joined: Wed Jun 01, 2005 10:50 am
Location: Craiova, Romania
Contact: Website

Hi,

It's hard to say what the problem might be. You could send the script and the AIP file (or a simpler one, that reproduces the problem) to support at advancedinstaller dot com. We can analyze it and see what the problem might be.

If you send them please pack them into a ZIP file, as the mail filter doesn't accept plain VBS files.

Regards,
Mihai
Mihai Bobaru
Advanced Installer Team
http://www.advancedinstaller.com

Return to “Feature Requests”