# $window.list Generates lists of windows
Usage
    $window.list(<type>[,<irc_context_id>])
Description
Returns an array of window identifiers with a speficied type and eventually belonging to a specified irc context. <type> is a window type such as 'query' or 'channel'. See window.listtypes for a list of available window types in this KVIrc release. If <type> is the special word 'all', all the window types are listed. <irc_context_id> specifies the irc context in which the windows are searched. If no <irc_context_id> is specified , the current one is used. If <irc_context_id> is the special word 'all', all the irc context are searched. If <irc_context_id> is the special word 'none' then only windows not belonging to any irc context are listed. The special word 'any' used as <irc_context_id> merges the effects of 'all' and 'none' by searching all the irc contexts AND the windows not belonging to any irc context. The windows that do not belong to any irc context (such as DCC windows), must be searched by using 'none' or 'any' as <irc_context_id>.
Syntax Specification
    $window.list(<type>[,<irc_context_id>])
Examples
        # List all the queries of the current irc context
        echo $window.list(query)
        # Equivalent to the above
        echo $window.list(query,$ic)
        # List all the channels in all the irc contexts
        echo $window.list(channel,all)
        # List all the windows in the current irc context
        echo $window.list(all)
        # List all the windows in all irc contexts
        echo $window.list(all,all)
        # List all the DCC Send windows: They don't belong to any irc context
        echo $window.list(dccsend,none)
        # List all the user windows created with $window.open
        # They may either belong to an irc context or not
        echo $window.list(userwnd,any)
        # Ok , let's use it
        # A nice alias that allows iterating commands through all the consoles
        # Note the array returned by $window.list
        # This is by LatinSuD :)
        alias(iterate)
        {
            %ctxt[]=$window.list(console,all)
            for(%i=0;%i<%ctxt[]#;%i++)
            {
                eval -r=%ctxt[%i] $0-
            }
        }
        iterate echo Hi ppl! :)
        # The returned array works nicely also in foreach
        # Say hi to all the channels :)
        alias(sayallchans)
        {
            foreach(%x,$window.list(channel,all))
                    say -r=%x $0-;
        }
        sayallchans Hi ppl :)
See also
window.listtypes

Index, Functions

KVIrc 3.4.0 Documentation
Generated by root at Mon Dec 22 00:58:26 2008