IZZI Posted February 6, 2018 Share Posted February 6, 2018 I'm trying to write an autoit script to replace some line in an XML file with input I get from the user. I have only used autoit to do some basic software install automation. I've been searching and found some code in the forums that is able to do some of what I'm looking for. My problem is that it's only putting in the numerical values and won't put in any of the text values I give it or a that was supplied from the user. Here is a copy of the code I have now. If you can point me to what I'm doing wrong that would be great. Thanks #Include <FileConstants.au3> #include <file.au3> ;Prompt user for variable information $ext = InputBox("Extension Numer", "Enter your phone extension number") $extpass = InputBox("Voice Mail Password", "Enter your voicemail password", "", "*") $alias = InputBox("Alias", "Enter your full name") $replace1 = "@Phoneserver.domain.com/main" Local $oXML = ObjCreate("Microsoft.XMLDOM") $oXML.load("base.xml") $oName = $oXML.SelectSingleNode("//name") $oName.text = ($oName.text) + $ext + $replace1 $oExtpass = $oXML.SelectSingleNode("//password") $oExtpass.text = ($oExtpass.text) + $extpass $oAlias = $oXML.SelectSingleNode("//alias") $oAlias.text = ($oAlias.text) + $alias $oXML.save ("accounts.xml") Link to comment Share on other sites More sharing options...
jdelaney Posted February 7, 2018 Share Posted February 7, 2018 (edited) Local $oXML = ObjCreate("Microsoft.XMLDOM") $oXML.load("base.xml") $oName = $oXML.SelectSingleNode("//name") $oName.text = ($oName.text) & $ext & $replace1 $oExtpass = $oXML.SelectSingleNode("//password") $oExtpass.text = ($oExtpass.text) & $extpass $oAlias = $oXML.SelectSingleNode("//alias") $oAlias.text = ($oAlias.text) & $alias $oXML.save ("accounts.xml") The + is actually adding the values. Strings are converted to numbers, and then added together...use & instead, to join strings. Edited February 7, 2018 by jdelaney IZZI 1 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
IZZI Posted February 7, 2018 Author Share Posted February 7, 2018 Dude you are awesome... Thanks for the info. That is something I didn't know. That change made all the difference and now the script works perfectly. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now