Jump to content

TableData - more efficient handling with table structured data


Recommended Posts

Nice job. Works fine.

It would be usefull to me if you add an Ok and Cancel Button and return the selected line (incl. double mouse click) . So we would have an easy to use selection dialog.

Only my 2 cents.

Thank you.

Regards

Sascha

Link to comment
Share on other sites

A new helpful function has been added in this context: The _td_join() function.
This combines the table objects here similar to an SQL join.

It is best explained using an example: We have the open ports via netstat and want to have the information on the corresponding process there.
The process information could be obtained via the "tasklist" command.

However, querying, preparing and merging the whole thing is a lot of paperwork.
With the UDF here, however, it is reduced to the following (the output of netstat might differ depending on the language) :

#include "TableData.au3"
#include <WinAPIConv.au3>

; get data from netstat
Global $mNetStat = _td_fromFixWidth(_getCmdOutput('netstat -ano'), "7;23;23;16;Number 100", "1-2", true)
; get data from tasklist
Global $mTaskList =  _td_fromCsv(_getCmdOutput('tasklist /FO CSV',  True), ',', 0, True)

; show data
_td_display($mNetStat, "netstat data")
_td_display($mTaskList, "tasklist data")

; link the NetStat data with the data for the associated process
$mJoined = _td_join($mNetStat, $mTaskList, "PID", "PID", "left")

; display the combined table object
_td_display($mJoined, "Joined tables: open ports and their corresponding process info")




; run cmdline-commands and return their output
Func _getCmdOutput($sCmd, $bComspec = False, $oFlags = $STDOUT_CHILD)
    Local $iPID = Run(($bComspec ? '"' & @ComSpec & '" /c ' : "") & $sCmd, "", @SW_Hide, $oFlags)
    ProcessWaitClose($iPID)
    Return _WinAPI_OemToChar(StdoutRead($iPID))
EndFunc

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...