brian75 Posted January 14, 2014 Share Posted January 14, 2014 Greetings all, I need to edit a user specific .xml file. The file name will never be the same. Is it possible to use a wild card for the file name with _FileWriteToLine? That one .xml is the only file in that directory. I was thinking something like this (Obviously, I tried this and it doesn't work): #include <File.au3> #RequireAdmin _FileWriteToLine("C:\ProgramData\Microsoft\WwanSvc\Profiles\*.xml", 9, "<ConnectionMode>manual</ConnectionMode>", 1) If not, I need to parse the file name and read it in to the _FileWriteToLine statement. Can I get some hints as to how to do that? Of course, I'm not married to using _FileWriteToLine. If there's a better way to go about it I'm all for it. I appreciate any help! Link to comment Share on other sites More sharing options...
jdelaney Posted January 14, 2014 Share Posted January 14, 2014 (edited) what is the parent node you want it nested under? You can use the XML dom to do so. example: $sXML = '<?xml version="1.0"?>' & @CRLF & '<Something/>' $oXML = ObjCreate("Microsoft.XMLDOM") $oXML.loadXML($sXML) $oNode = $oXML.createElement("ConnectionMode") $oNode.text = "manual" $oParent = $oXML.selectSingleNode( '//Something' ) $oParent.appendChild($oNode) ConsoleWrite($oXML.xml & @CRLF) $oXML.save("yourfile.xml") well, this is how to correctly modify the file. what do you want from the wild card? Are there multiple files? Use _FileListToArray to get your collection, loop through that array, and do the above. Edited January 14, 2014 by jdelaney 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...
brian75 Posted January 16, 2014 Author Share Posted January 16, 2014 Hi jdelaney, Thanks for your response! I am not at all familiar with using the XML DOM so I am researching that now but it looks like what I need. I'll post back my solution once I get it figured out or if I run into a roadblock. Thanks again! Link to comment Share on other sites More sharing options...
Malkey Posted January 16, 2014 Share Posted January 16, 2014 To get the actual file name, _FileListToArray will allows the use of wildcards. 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