Jump to content

dickep

Active Members
  • Posts

    162
  • Joined

  • Last visited

dickep's Achievements

  1. Inververs, Thanks, this does exactly what I had hoped for. Now to digest what you did and how it works so I can use this sometime later - for other projects. E
  2. jdelany, I tried the last sample but it still did not get the first 9 'lists' data. Am I looking at this wrong? Or is there something else that needs tweeked? I am trying to understand the XML file format to help me be able to import these for a project at a later date. Thanks E
  3. jdelany, thank you. this works HOWEVER, not sure I understand where or what is meant by the comment "; if there is only ever 1 instance, no need to grab nodes...can instead selectSingleNode". Can this work with the sample file that has single layer nodes mixed with multi-layer nodes? Or .... well, not sure about how to get all the xml node data out properly using the Sample.xml file I have attached. Thanks again E
  4. OK, I tried something (using some of the linked information) and am getting closer. However, not getting the last "layer". $oXML = ObjCreate("Microsoft.XMLDOM") $oXML2 = ObjCreate("Microsoft.XMLDOM") $oXML3 = ObjCreate("Microsoft.XMLDOM") $oXml.load('C:Sample.xml') $result = $oXML.selectNodes( '//ReadItemLists' ) For $Node In $result $oXML2.loadxml($Node.xml) $result2 = $oXML2.selectNodes( '//ReadItemList' ) $iCounter = 1 For $Node2 In $result2 $children = $Node2.childnodes For $child in $children ConsoleWrite ( "GroupInstance=[" & $iCounter & "] childNode|value=[" & $child.nodename & "|" & $child.text & "]" & @CRLF ) Next $iCounter +=1 Next ConsoleWrite ( @CRLF ) Next I am still using the Sample.xml input file just need to get the next "ReadItem" data. Thanks E P.S. not currently using $oXML3 as I was trying to figure out where to call it.
  5. Thanks. Now how can I traverse through the next N number of items? I got this to work for the first one, but it stopped after that. E
  6. OK, I got something from another question and have gotten it to work - somewhat. I can get the first element and the child node data. BUT, how do I get the rest? How can I get all the ReadItemList child node values?Sample.xml Here is my code: $oXML = ObjCreate("Microsoft.XMLDOM") $oXml.load('C:\Documents\Sample.xml') $oNodes = $oXML.selectSingleNode("//ReadItemList") For $oNode In $oNodes.childnodes ConsoleWrite('Loop val: ' & $oNode.nodeName & ' -- ' &$oNode.text & @CRLF) Next here is my xml file attached. It is much larger but for this I thought a subset would suffice. Thanks E
  7. Thanks for the link. It is, however, different in that it is looking at a "known" XML schema. I want to be able to do any XML file. I am starting to code something but not sure where it may take me. Still need some "guidance" on a true generic XML parser/reader. E
  8. I understand that. But, I am having a difficult time trying to see how to get this started. I don't really "comprehend" the XML DOM functions so need some helping hands with that. Does the XML DOM have the ability to just read the file and store the information like I think I need it to be stored - in array(s)? Thanks E
  9. OK, I looked around here and did not find what I think I am looking for. What I want is a "generic" XML reader - something that will read a complete XML file and give me the nodes with their values in some sort of array. Does this sound OK? I am not an XML guru nor a great programmer. I just need to get any XML file and be able to parse and use the XML information. Thanks E
  10. OK, here is a sample of what I am doing. It is not working like I want and if you run it you can see that the DESCRIPTION labels are not adjusting (or maybe the data labels are not, not sure which to do). #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <IE.au3> Opt("GUIOnEventMode", 1) HotKeySet("{ESC}", "Terminate") Global $avArray[500] Global $iteration Dim $countDowner = "************************************************************" Dim $aIE[1] $aIE[0] = 0 DIM $i = 1 Dim $LoopCount = 3 $GUITitle = "Information" #Region ### START Koda GUI section ### Form= $MessageBoard = GUICreate($GUITitle, 441, 109, 192, 124) $Label1 = GUICtrlCreateLabel("label1", 30, 32, 48, 17) $SleepIndicator = GUICtrlCreateLabel("SleepIndicator", 88, 32, 15, 17) $escLabel = GUICtrlCreateLabel("Press ESC to end application", 40, 8, 141, 17) $label3 = GUICtrlCreateLabel("label3", 40, 58, 48, 17) $interationLabel = GUICtrlCreateLabel("interationLabel", 95, 58, 32, 17) $Label4 = GUICtrlCreateLabel("Iteration: ", 40, 85, 48, 17) $LoopCount = GUICtrlCreateLabel("", 90, 85, 20, 17) GUISetState() ; show the form for now. ;~ get the IE windows/tabs open While 1 $oIE = _IEAttach("", "instance", $i) If @error = $_IEStatus_NoMatch Then ExitLoop ReDim $aIE[$i + 1] $aIE[$i] = $oIE $aIE[0] = $i $i += 1 $avArray[$i - 1] = $oIE.LocationURL WEnd ;~ $avArray[0] = $i - 1 While 1 $nMsg = GUIGetMsg() ;~ ====++++++++++++ ;~ test area ;~ $avArray is the array of URL's that IE has open $GUITitle = "URL Processing" WinSetTitle($MessageBoard, "", $GUITitle) _GUILabelSetText($label1, "Processing URL: ") _GUILabelSetText($SleepIndicator, $avArray[1]) _GUILabelSetText($label3, "") _GUILabelSetText($interationLabel, "") sleep(3000) $GUITitle = "URL Processing again" WinSetTitle($MessageBoard, "", $GUITitle) _GUILabelSetText($label1, "Processing URL: ") _GUILabelSetText($SleepIndicator, $avArray[2]) _GUILabelSetText($label3, "") _GUILabelSetText($interationLabel, "") sleep(3000) $GUITitle = "Pausing " WinSetTitle($MessageBoard, "", $GUITitle) _GUILabelSetText($Label4, "Iteration: ") _GUILabelSetText($LoopCount, $iteration) _GUILabelSetText($label1, "Sleeping: ") _GUILabelSetText($label3, "Minutes Left: ") $sleepEnd = 2 for $p = $sleepEnd - 1 to 1 Step -1 ; 5 minute pause $sInd = "" _GUILabelSetText($interationLabel, $p) for $q = 1 to 60 $sInd = $sInd & "*" _GUILabelSetText($SleepIndicator,StringLeft($countDowner, 60 - $q)) sleep(990) Next Next ;~ Exit ;~ ========================= Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _GUILabelSetText($iCtrlID, $sText) Local $asSize $asSize = _StringSize($sText) ControlMove("", "", $iCtrlID, Default, Default, $asSize[0], $asSize[1]) Return GUICtrlSetData($iCtrlID, $sText) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _StringSize ; Description ...: Returns the size (in pixels) of an string. ; Syntax.........: _StringSize( "string" [, size [, weight [, fontname ]]] ) ; Parameters ....: string - The string to evaluate the size. ; Size - [Optional] Fontsize (default is 9). ; Weight - [Optional] Font weight (default 400 = normal). ; FontName - [Optional] Font to use (OS default GUI font is used if the font is "" or is not found). ; Requirement(s).: ; Return values .: Success - Returns a 2-element array containing the following information: ; $array[0] = Width ; $array[1] = Height ; Failure - Returns the same array with 0 and sets @error to 1. ; Author ........: jscript ; Example .......: _StringSize( "Text" ) ; =============================================================================================================================== Func _StringSize($sString, $iSize = 9, $iWeight = 400, $sFontName = "") Local $hWnd, $hGuiSwitch, $iCtrlID, $aCtrlSize, $aRetSize[2] = [0, 0] $hWnd = GUICreate("StringExInternalWin", 0, 0, 0, 0, BitOR(0x80000000, 0x20000000), BitOR(0x00000080, 0x00000020)) $hGuiSwitch = GUISwitch($hWnd) If $iSize = 65535 Then ; Used by _ImageSize $iCtrlID = GUICtrlCreatePic($sString, 0, 0, 0, 0) Else GUISetFont($iSize, $iWeight, -1, $sFontName, $hWnd) $iCtrlID = GUICtrlCreateLabel($sString, 0, 0) EndIf $aCtrlSize = ControlGetPos($hWnd, "", $iCtrlID) GUIDelete($hWnd) GUISwitch($hGuiSwitch) If IsArray($aCtrlSize) Then $aRetSize[0] = $aCtrlSize[2]; Width $aRetSize[1] = $aCtrlSize[3]; Height Return SetError(0, 0, $aRetSize) EndIf Return SetError(1, 0, $aRetSize) EndFunc ;==>_StringSize Func Terminate() Exit 0 EndFunc ;==>Terminate
  11. I have a GUI I created that I would like to use for multiple messages. This GUI could then reside on the display and give the user status for what is happening. However, I need to make some labels (the static type) that will be in different lengths. The corresponding data should then be displayed in static form (I found UEZ's StringSize UDF and the _GUILabelSetText function with it). Using the UDF, I can get the data text size to be dynamic, but the left of the created label stays the same. How can I "move" the left starting point of the data label to be about 2 characters right of the end of the "descriptor" label? Thanks E
  12. OK, thanks jdelaney. It is now working like I want it to. Hmm........ maybe one of these days I will learn that the Help file is there to really help not just take up disk space (which a lot of Help files are doing).
  13. I see that. But how can I refresh the data in the tab without having to activate it first?
  14. I have a script that reads IE data from the page displayed. It works for multiple pages like I want (really one IE open with multiple tabs for the various pages). Now, I would like to know if I can have this work but in the background. In other words, I want to be able to read the data ouf of the tabs of the IE but do not want the IE and/or tabs to be actively opened. Make sense??? Thanks E
  15. Thanks both Zedna and Melba. Melba, your help made this work. I also learned a lot from doing this "project" Thanks hugely to all
×
×
  • Create New...