New stuff is organized into subpages... On April, 12. 2006 I did a big reorganization of my pages. Sorry for floating the recent changes list...
bgexec: launches processes in background, catches output via fileevent-handler
See Matthias Hoffmann - Tcl-Code-Snippets - Misc - Bgexec for a new, less buggy but not yet translated version of bgexec.
Remarks: unfortunally, STDERR-CATCHing with 2>@ does't seems to work with Windows 2000...... For 8.4.7 and above, there is or will be a fix, see http://www.tcl.tk/cgi-bin/tct/tip/202.html .
A simple ADSI-Example using tcom:
proc logEvent {evtType args} { # ohne Fehlernachricht catch { set wsh [::tcom::ref createobject "WScript.Shell"] $wsh LogEvent $evtType "[regsub -all {\n} $args { - }]" } }
One more complicated example: return the available Windows-NT- and ADS-Domains and Workgroups as a list:
proc GetDomains {} { set ret {} if [catch {::tcom::ref getobject "WinNT:"} d] then { return -code error "<getobject 'WinNT:'> failed: $d" } else { ::tcom::foreach domain $d { if ![catch {::tcom::ref getobject [$domain ADsPath],domain}] { set ct (Domain) } else { set ct (Workgroup) } lappend ret [list [$domain Name] $ct] } } return $ret }
And another one: get the groups of a given container (that is, a Domain or Workgroup):
proc GetGroups {container {contype domain}} { set ret {} # get Domain-/Computerobject if [catch {::tcom::ref getobject "WinNT://$container,$contype"} g] then { return -code error "<getobject 'WinNT://$container,$contype'> failed: $g" } ::tcom::foreach m $g { # instead of IF one can use a -filter here... if {[$m Class] == "Group"} { lappend ret [$m Name] } } return $ret }
(contype can be domain or computer)
And finally get the users within such a group:
(...to be done...)
Reminder:
Have you considered submitting these for inclusion in tcllib? M.H.: no, I think I haven't yet reached the required level of tcl-knowledge ...