2010-09-26

使用 tcom 取得 network adapter name list

proc getNetworkAdapter {} {

    package require tcom;

    if [catch {::tcom::ref getobject "winmgmts:root/CIMV2"} wmi] then {
     return -code error $wmi;
    }

    set wql {SELECT * FROM Win32_NetworkAdapter}


    if [catch {$wmi ExecQuery $wql} tmp] then {
        return -code error $tmp;
    }
    
    ::tcom::foreach instance $tmp {
        set propSet [$instance Properties_]
        set msgVal [[$propSet Item NetConnectionID] Value]
        
        if {[string equal $msgVal ::tcom::NULL] == 0} {                         
            lappend Result $msgVal
        }
    }     

    return $Result    
}

使用 tcom 透過 WMI 拿到 network adapter name 的 list。

參考資料:
Matthias Hoffmann - Tcl-Code-Snippets - tcom & wmi - Examples 

2010-09-17

ActiveTcl 8.5.9.0

ActiveTcl 8.5.9.0 已經在 ActiveState 的網站上可以下載了。


Tcl 8.5.9 的改變:

* TIP 359: new X11 option: [wm attributes -type]
- stops inappropriate Compiz animation of Tk menu & combobox.

* TIP 360: modernize menus on X11.
* New widget [ttk::spinbox].

* [lappend arr(elem)] no longer fires read traces as it inconsistently
has in some situations, but not in others.
*** POTENTIAL INCOMPATIBILITY ***

* [tk_getOpenFile] on Windows: unlimited multiple-file selection.

* [load] uses LOAD_WITH_ALTERED_SEARCH_PATH for fewer surprises when
bringing in DLLs via dependencies on Windows.
*** POTENTIAL INCOMPATIBILITY ***

* Updated [send] security rules to current Ubuntu/Fedora conventions.
* Fixed [wm iconphoto] on LP64 unix systems.
* [chan copy] of more than 2**31 bytes is now possible.
* min() and max() functions now work in safe interps.
* [$menu delete $tooBig end] now properly a no-op.
* canvas items now properly updated when canvas state changes.
* Revised [ttk::sizegrip] to accommodate Compiz.

* Revised default Text bindings for and to account;
for insertion point relationship to the selection.

* Corrected result of [tcl::mathfunc::abs 0.0].
* New version 1.432 of msgcat package.
* New version 1.0.9 of platform package.
* New version 0.8.6 of tile package.
* Changes to support building with MSVC++ 2010.
* Prevent race condition in some XIM implementations.
* Fixed bad results from [file rootname].
* Prevent consumption of all memory when [chan copy] copies to slow channel.
* [wm transient] now works even with withdrawn windows.
* $DISPLAY can now contain "::".
* Restored compatibility of [entry] validation with Itcl variable scope.
* Fixed line-sensitive matching by [regexp].
* Fixed memory corruption in complex canvas tag searches.
* Fixed crash in encoding finalization.
* Fixed crashes in widget destruction.
* Fixed crash in GetFontFamilyName().
* Fixed crash in menu deletion.
* Fixed crash in peer text dump.
* Fixed crash when bind scripts are empty.
* Fixed crash in unset traces during [array unset].
* Fixed crash deleting vars during callframe pop.
* Fixed crash in [open |noSuchFile rb].
* Fixed crash in [chan postevent].
* Fixed programming error in [clock format] in he_IL locale.
* Safe Base and Safe Tk rewrites

下載地點:
Download ActiveTcl Community Edition