$window.list
Generates lists of windows
Usage
$window.list(<type>[,<irc_context_id>])
Description
Returns an array of window identifiers with a specified 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>.
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(dcctransfer,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