/mecho (mass /echo)

By raccoon on Jan 05, 2015

; MECHO (mass /echo) - sends echo to multiple windows of specified type(s).
; 
; Usage:  /mecho <-asnqdtu#?=@> <echo's normal parameters, excluding target>
; 
; Where:  -a = all, -s = status, -n or -# = channels, -q or -? = queries,
;         -d or -? = single message window, -t or -= = chats, -u or -@ = custom windows.
; 
; Also:   The magic characters '\#' and '\@' can be used to reference a window's name and $wid.
;         You can force identifiers to be re-evaluated for a given window using $!identifier.
; 
; Examples:
;  /mecho -a 4 Hello World!
; //mecho -a -ntic info *** Day changed to $asctime(dd mmm yyyy) $+ , a $asctime(dddd) $+ .
; //mecho -# -ntic whois *** Summary: \# has $!nick(\#,0,o) ops, $!nick(\#,0,v) voices, $!nick(\#,0,r) regulars.
; 
; Note: /mecho is extremely handy with /scon -a and /timers, but be aware of their stacking re-re-re-evaluation.
; //.timer_hourly 0 3600 /scon -a /mecho -s#?= -ngti Hourly Report: \# has $!!!line(\@,0) lines.
; 
mecho { ; by Raccoon 2015
  var %types = $$replacex($replace($regsubex($$iif(-* iswm $1,$v2),/[^asnqdtu#?=@]/g,) $& 
    ,a,snqdtu,$chr(35),n,?,qd,=,t,@,u),s,status.,n,channel.,q,query.,d,message.,t,chat.,u,custom.)
  var %i = 1 
  while ($window(*,%i).wid) { 
    var %wid = @ $+ $v1, %name = $window(%wid), %type = $window(%wid).type
    var %echo = $regsubex($replacex($$2-,\@,%wid,\#,%name),/^((?:\d+ )?(?:-\S*c\S* \S+ |-\S+ )?)(.*)/,\1%wid \2)
    if ($istok(%types,%type,46)) { echo [ [ %echo ] ] }
    inc %i
} } ; http://hawkee.com/snippet/16185/

Last updated: 06-January-2015

  • Fixed: -# switch not working -- changed instance of "#" to "$chr(35)" in "var %types".

Comments

Sign in to comment.
raccoon   -  Jan 06, 2015

@Hawkee : The gap above bullets is too gappy. :)

Hawkee  -  Jan 06, 2015

Thank you, it might require a little tweaking.

Sign in to comment

ovelayer   -  Jan 05, 2015

well done

raccoon  -  Jan 06, 2015

let me know if you find any creative uses for it. :)

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.