Click here to Skip to main content
15,878,814 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
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.

VB
Set xmlDoc = _
  CreateObject("Microsoft.XMLDOM")  

'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


xmlDoc.save ("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 _
  ("/Hudson1/Profiles/Secure/ssid")

For Each objVersion in colNodes1
   objVersion.Text = strSsid
Next

strDeviceIp = UserInput( "Enter Device IP Address:" )
Set colNodes2=xmlDoc.selectNodes _
  ("/Hudson1/General/System/ipaddr")

For Each objVersion in colNodes2
   objVersion.Text = strDeviceIp
Next

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

Set colNodes3=xmlDoc.selectNodes _
  ("/Hudson1/Profiles/Secure/psk")

For Each objVersion in colNodes3
   objVersion.Text = strWpaPassword
Next


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


Set colNodes4=xmlDoc.selectNodes _
  ("/Hudson1/Router/HTTP/password")

For Each objVersion in colNodes4
   objVersion.Text = strAdminPassword
Next
    	





xmlDoc.save "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
Updated 6-Sep-12 3:27am
v2
Comments
[no name] 5-Sep-12 15:33pm    
And what type is xmlDoc?
ZurdoDev 5-Sep-12 16:24pm    
Where is the code where you define xmlDoc?
Flatlineskillz 6-Sep-12 8:50am    
Set xmlDoc = _
CreateObject("Microsoft.XMLDOM")
ZurdoDev 6-Sep-12 9:10am    
According to http://msdn.microsoft.com/en-us/library/windows/desktop/ms757828(v=vs.85).aspx the method is save, lowercase.
Flatlineskillz 6-Sep-12 9:12am    
Tried that and it didnt work

1 solution

 
Share this answer
 
Comments
Flatlineskillz 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 7-Sep-12 11:23am    
If you don't have to use vbscript, use c# or vb.net 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900