Click here to Skip to main content
11,437,713 members (44,094 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VBScript XML
I have a script to create xml config files for Mifi boxes that we will be deploying on a large scale. I want to be able to take input from the user as to what the config file is named. I have added more code below the only thing I am leaving out are the 800+ lines of me creating all the config file XML fields.


Set xmlDoc = _
'here is where I create all the fields of the xml config file
'Code continued below.

strConfigFileName = UserInput ( "Enter output file name" )
Set myFSO = CreateObject("Scripting.FileSystemObject")
Set OutputFileName = myFSO.OpenTextFile( "C:\Users\testing\Documents\Scripts\Edit XML\" & strConfigFileName & ".xml", 8, True)
OutputFileName.Close ("C:\Users\testing\Documents\Scripts\Edit XML\" & OutputFileName)

xmlDoc.Async = "False"
xmlDoc.Load("C:\Users\testing\Documents\Scripts\Edit XML\" & OutputFileName)


strSsid = UserInput( "Enter Device SSID:" )
Set colNodes1=xmlDoc.selectNodes _
For Each objVersion in colNodes1
   objVersion.Text = strSsid
strDeviceIp = UserInput( "Enter Device IP Address:" )
Set colNodes2=xmlDoc.selectNodes _
For Each objVersion in colNodes2
   objVersion.Text = strDeviceIp
strWpaPassword = UserInput( "Enter WPA Password:" )
'WScript.Echo "You entered: " & strInput

Set colNodes3=xmlDoc.selectNodes _
For Each objVersion in colNodes3
   objVersion.Text = strWpaPassword

strAdminPassword = UserInput( "Enter Admin Password:" )
'WScript.Echo "You entered: " & strInput

Set colNodes4=xmlDoc.selectNodes _
For Each objVersion in colNodes4
   objVersion.Text = strAdminPassword
     "C:\Users\testing\Documents\Scripts\VBScript to XML\mifisettings.xml"  

but it is telling me that the xmlDoc.Save does not support this method. Can anyone help?
Posted 5-Sep-12 10:28am
Edited 6-Sep-12 4:27am
Wes Aday at 5-Sep-12 15:33pm
And what type is xmlDoc?
ryanb31 at 5-Sep-12 16:24pm
Where is the code where you define xmlDoc?
Flatlineskillz at 6-Sep-12 8:50am
Set xmlDoc = _
ryanb31 at 6-Sep-12 9:10am
According to the method is save, lowercase.
Flatlineskillz at 6-Sep-12 9:12am
Tried that and it didnt work
ryanb31 at 6-Sep-12 9:15am
What happened when you used lowercase save?
Flatlineskillz at 6-Sep-12 9:17am
same error object doesn't support this property or method
ryanb31 at 6-Sep-12 9:22am
Well, the documentation says it does. Doesn't mean the documentation is right. I think you need to show more of your code then.
Flatlineskillz at 6-Sep-12 9:28am
I updated the code above. I added everything I have except for the many lines that create all the records and fields in the XML file. Regardless I appriciate you taking the time to help me out.
ryanb31 at 6-Sep-12 9:54am
If you look at the link I included the examples are actually creating a Msxml2.DOMDocument.3.0. You may want to try that instead. I wonder if what you are using is much older.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Flatlineskillz at 7-Sep-12 11:14am
I am not sure what you mean. I tried switching to a newer version of the MSXMLDOM but I still get the same error. Do you mean try using an ActiveXObject. I apologize but I don't do much scripting and this is the first time I have used VBScript and XML together. Thanks for your time.
Mehdi Gholam at 7-Sep-12 11:23am
If you don't have to use vbscript, use c# or instead it will much simpler and easier.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Advertise | Privacy | Mobile
Web02 | 2.8.150506.1 | Last Updated 6 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100