Jump to content

Recommended Posts

Hi all,

I've recently be kinda forced into trying to learn OOP within AutoIt. I'm trying to convert XML into objects I guess instead of trying to parse it into arrays within arrays. An example is below:



  • How can I convert this?
  • Would <roles> be $User.Roles?
  • If so would the children be $User.Roles.Role.Agent and $User.Roles.Role.Supervisor? 
  • If not, how do I reference each Object?

Any assistance would be appreciated. I tried to understand XML.au3 but I'm so confused trying to wrap my head around this.

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

Cisco FinesseGithubIRC UDFWindowEx UDF


Link to post
Share on other sites

Forum search .selectnodes.  return that to a variable like $oRoles.  xpath is //role

Loop through like:

For $oRole in $oRoles

     consolewrite  ($oRole.text & @crlf)



Edited 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 post
Share on other sites

_XML_SelectNodes expects XML input for the first parameter and the "path" as the second? Does it return an array or strings? I'm still so confused at exactly the $oNodes_coll return is...

Edit: Just saw your edit. I'll try that.

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

Cisco FinesseGithubIRC UDFWindowEx UDF


Link to post
Share on other sites

I seem to be getting a DOMVersion (4) error. However @extended is "0". I'm confused if I'm doing something wrong?

Edit: It appears I'm getting IsNotObject. I guess I need to convert my XML text to an Object for the First Parameter of _XML_SelectNodes?

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

Cisco FinesseGithubIRC UDFWindowEx UDF


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By rcmaehl
      Hi all,
      My work has recently switched from a Win32 based application to a web based application. Thankfully there's an API for me to attach to now but I have a few questions since I'm using Objects now for some parts of my scripts...
      Do I need to run ObjCreate("winhttp.winhttprequest.5.1") everytime before any object stuff or can I just run it once at the beginning of my script and reuse it? Is $oHTTP.Open("GET", <url>) followed by $oHTTP.Send() pretty much the same as INetRead and can I use them interchangeably? Do I need to somehow delete the Object after creating it at the end of my script? - Answered by Helpfile Thanks!
    • By kingjacob90
      I am wanting to know what my CPU temp is but don't know what object to use. I don't relay know how objget works so would not know where to start. I have seen people integrate things like windows speech to text into their scripts but don't know how they know what object to use! How do I find the right object? And how dose it work?
      Thanks Jacob
    • By RaiNote
      How to work easily and fast with the oleview.exe which Displays the Object COM from Windows and other programs~
    • By Keithw
      I'm trying to create a remote object using the example script on the ObjCreate function reference page:
      #include <MsgBoxConstants.au3> ;Open the MediaPlayer ona REMOTE computer Local $oRemoteMedia = ObjCreate("WMPlayer.OCX", "W2RATD5NGK32", "W2RATD5NGK32\administrator", "Win7Pilot") If Not @error Then MsgBox($MB_SYSTEMMODAL, "Remote ObjCreate Test", "ObjCreate() of a remote Mediaplayer Object successful !") $oRemoteMedia.openPlayer(@WindowsDir & "\media\tada.wav") ; Play sound if file is present Else MsgBox($MB_SYSTEMMODAL, "Remote ObjCreate Test", "Failed to open remote Object. Error code: " & Hex(@error, 8)) EndIfThe message returns:  Failed to open remote Object.  Error Code:  80004002 
      I've tried researching this error but haven't found any useful info.  All I know are these requirements below and I know for sure that the services are running, and the script is being executed as x64 with admin rights.
      I'm now at a dead end and not sure how to further troubleshoot this error.  Also, the script runs fine when I use my own hostname.  Any ideas? 
    • By Ascend4nt
      Kernel Objects Information

      Sample output of Object Handles probing
      I've assembled a number of UDF's which use "undocumented" features of the O/S over the years. And this here would be the latest, and possibly the last (I hope?).
      The purpose of this UDF is to query kernel objects in the system.  It's actually a pretty big UDF that ties together a lot of functionality, and hopefully makes it more accessible.
      With the UDF you can:
      Query a Kernel Object for 'hidden' information using its handle: Object Type and stats (_ObjectGetTypeInfoUD), Attributes and Access (_ObjectGetBasicInfoUD), Kernel Object Name (_ObjectGetNameUD), etc
      Query certain Kernel Event Objects for current states:Event, IoCompletion and Mutex ("Mutant") signal states (and more), Semaphore counts, Timer's remaining time, etc
      Get a list of opened File handles and filenames (there's already a few UDF's dedicated to that, though) Collect all the current handles held by the O/S and its processes, using specific filters, and get information on what the object is and its current state  

      Kernel Objects Inspector script
      What's an Object you say? Whats a Kernel? Whats an NT? Gosh, maybe you shouldn't be here - go read Youtube.

      As Windows programmers, we make use of these Kernel Objects all the time...

      Object Types List
      Some of the most common System Objects: Token, Process, Thread, Event, Mutant (Mutex), Semaphore, Timer, File (includes NamedPipe and Mailslot), Key (Registry Key)
      Anytime you work with these objects, you are generating new objects at the kernel level.  Luckily, the O/S allows above 16 million handles per process (see Pushing the Limits of Windows: Handles by Mark Russinovich), so this isn't a concern. However, if an individual process has in excess of 16K handles, there will be some trunacted values returned from the NT API call as it only returns 16-bit values for handles.  See >this post where I try to describe this in better detail.  However, this is no longer a problem with the latest update, which restores the upper bits of handles through a simple wraparound detection technique.
      There's more to say, but perhaps its best to show what functions are available. From the NTKernelObjectsInfo UDF Header:

      Querying time issues: Note that any call to query handles (_NTObjGetHandlesUD, _NTObjGetHandlesInfoEx) relies on a call to NtQuerySystemInformation, which gathers information on EVERY handle held by the system and it's processes.  This can take a few seconds! Be patient.  (Also, _NTObjBuildTypesIndexMap calls it indirectly)

      IMPORTANT: Be a little careful with looking for 'File' objects on Vista and Win7.. on XP there's already some safeguards which unfortunately prevent detecting certain objects. Newer versions of the O/S don't seem to have problems with threaded probing of File objects, but there may be some cases..
      The Console output is still a bit noisy, but its good for analyzing where there's problems in reading handles, or analyzing "File" handles which can cause major problems, especially in the case of NamedPipes.
      Some example UDFs are included:
      NTSystemObjectsList: displays a list of System Object Types NTKernelObjectsCollectExample: A collection query at its simplest (see below for this example) NTKernelObjectsSelfExamine: creates a number of different Objects before listing everything NTKernelObjectsInspect: Inspect Kernel Objects with Filtering options from a GUI This GUI needs work! Notice that with the ArrayDisplay function, there is a 'Run User Func' option which will display any extra info retrieved for the object (see ExInfo column).
      NTKernelObjectsSpam: Creates a crapload of Kernel Objects. This is mostly useless, but its here to demonstrate how NTKernelObjectsInspect now is able to report correct handle values beyond 65,536  
      In this example I query only 2 processes for handles, and use exclusion criteria to remove "File" and "EtwRegistration" from the resultant list.
      ; =========================================================================================================== ; <NTKernelObjectsCollectExample.au3> ; ; Pretty barebones example of NTKernelObjectsInfo, showing the ease with which objects can be collected ; Uses multipe query types, multiple processes, and multiple Object Types with exclusion rules ; ; Author: Ascend4nt ; =========================================================================================================== #include "NTKernelObjectsInfo.au3" #include <Array.au3> ; -= FLAGS to Tweak Object Querying =- ; Force Win2000/XP Attribute skipping (must appear AFTER #include): ;$g_NTKO_bNamedPipeProtect = True ; Alternatively set own: ;$g_NTKO_sFileAttribSkipList = "0x0012019F|" ; Additionally, can force BadMask Skipping to OFF (not recommended): ;$g_NTKO_bSkipBadMasks = False ; Other queries available, although less often used: ; $NTOBJ_QUERYBY_PID (example: @AuotItPID), $NTOBJ_QUERYBY_OBJTYPE (ex: 28), and $NTOBJ_QUERYBY_HANDLE (actual object handle) $aRet = _NTObjGetHandlesInfoEx($NTOBJ_QUERYBY_PROCESSNAME, "firefox.exe|autoit3.exe", _         $NTOBJ_QUERYBY_OBJTYPENAME + $NTOBJ_QUERY_EXCLUDE, "File|EtwRegistration") ConsoleWrite("Errors: " & @error & ", @extended = " & @extended & @CRLF) _ArrayDisplay($aRet, "_NTObjGetHandlesInfoEx") Thanks for testing this out!
      Change History:

      NTKernelObjects.zip  ~prev Downloads: 55
  • Create New...