cesinha87 Posted June 22, 2015 Share Posted June 22, 2015 Hello everyone I am new to AutoIt ( in fact it has being less the 24 hours I am playing with this), I've been watching tutorials and googling a lot. I am trying to create an KODA interface that will do the following 1. Open an .xml file 2. Search for any string that start with <Setting name="ExcludedItem_3. Save/export to a new file everything that found with the string in the above steps.... Attach is a screenshot from xml file. I understand that the only way to learn is by doing it but I am stuck and I don't know where to go. I am able to browser the file but I don't know how to start the search inside of the file and save to an directory. Please can anyone help me or guide me, I looked over and over help file and not sure where to go here is what I have so far - I've stopped in the StringinStr, I don't know anymore #include <ButtonConstants.au3>#include <GUIConstantsEx.au3>#include <WindowsConstants.au3>#Region ### START Koda GUI section ### Form=Global $Converter = GUICreate("Converter", 287, 123, -1, -1)Global $File = GUICtrlCreateButton("File", 16, 16, 99, 25)Global $Execute = GUICtrlCreateButton("Execute", 152, 16, 91, 25)Global $Save = GUICtrlCreateButton("Save", 80, 56, 99, 25)GUISetState(@SW_SHOW)#EndRegion ### END Koda GUI section ###While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $File $OpenLocation = FileOpenDialog ('Open File', @ScriptDir, 'XML file (*.xml)', 16) If @error Then ; Display the error message. MsgBox(4096, "", "No file(s) were selected.") EndIf Case $Execute StringInStr $OpenLocation EndSwitchWEnd Link to comment Share on other sites More sharing options...
iamtheky Posted June 22, 2015 Share Posted June 22, 2015 I'm not retyping that, If you need help with string operations post strings. If you need help with picture operations, post pictures. JohnOne 1 ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 23, 2015 Moderators Share Posted June 23, 2015 bothhose is correct, posting a picture of the xml file does no one any good - no one is going to sit and manually retype your file for you. That said, you should be able to easily do this by reading the file into an array (FileReadToArray), then enumeration through the lines of the file with StringInStr, like so: #include <File.au3> $aArray = FileReadToArray(<path to xml>) For $sLine in $aArray If StringInStr($sLine, '<Setting name="ExcludedItem_') Then ;Do Stuff EndIf Next "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Developers Jos Posted June 23, 2015 Developers Share Posted June 23, 2015 Please post support questions in the appropriate forum.Moved - Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
jdelaney Posted June 24, 2015 Share Posted June 24, 2015 Local $oXML = ObjCreate("Microsoft.XMLDOM") $oXML.load("test.xml") ; add your actual xml file here $oSettings = $oXML.SelectNodes("//Setting") For $oSetting In $oSettings If StringInStr($oSetting.getAttribute("name"),"ExcludedItem_") Then $sValue = String($oSetting.getAttribute('value')) ; output this part to your new file ConsoleWrite($sValue & @CRLF) EndIf Next 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...
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