mIRC Home    About    Download    Register    News    Help

Print Thread
$activewid #143464 24/02/06 06:18 PM
Joined: Dec 2002
Posts: 230
G
greeny Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Dec 2002
Posts: 230
Add an identifier like $activewid that works like $active but returns the $wid of the currently active window.

$window($active).wid won't work for that since there can be multiple windows with the same name.

Re: $activewid #143465 24/02/06 09:17 PM
Joined: Feb 2006
Posts: 546
J
jaytea Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
ya this would be a good addition, not that i currently need it, but only because it's not possible to script accurately (duplicate dcc windows of the same name for example) :X


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Re: $activewid #143466 24/02/06 09:32 PM
Joined: Nov 2004
Posts: 804
Jigsy Offline
Hoopy frood
Offline
Hoopy frood
Joined: Nov 2004
Posts: 804
$lactivewid too


What do you do at the end of the world? Are you busy? Will you save us?
Re: $activewid #143467 25/02/06 12:02 AM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Agreed, it would be nice to have it built-in. In the meantime, here's a workaround:
Code:
alias activewid {
  var %i = 1
  while $window($active,%i).wid {
    var %w = @ $+ $v1, %c = $window(%w).sbcolor
    window -g1 %w
    if !$window(%w).sbcolor { return $mid(%w,2) }
    window -g $+ $calc($findtok(message highlight event,%c,32)) %w
    inc %i
  }
}


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: $activewid #143468 25/02/06 01:06 AM
Joined: Dec 2002
Posts: 230
G
greeny Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Dec 2002
Posts: 230
Thanks qwerty, pretty clever smile

Re: $activewid #143469 25/02/06 05:10 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Agreed, very nice. (I have added this to my library of functions, even tho i dont currently have a use, better than trying to remember it later)

First use of a 6.17 addition i have seen, and solves the problem of $activewid with very little code being executed.

Not that you asked for it, but i cant really think of a use for $lactivewid, im sure there would be one, but i cant think of it.

Re: $activewid #143470 25/02/06 07:26 PM
Joined: Nov 2004
Posts: 804
Jigsy Offline
Hoopy frood
Offline
Hoopy frood
Joined: Nov 2004
Posts: 804
I kind of thought of this now ...

Code:
on *:active:*:{
  if ($lactive) { window -n $+(@,$lactivewid) }
  mdi -t
}


My current workaround ...

Code:
on *:active:*:{
  if ($lactive) {
    scid $lactivecid
    window -n $qt($lactive)
    scid $activecid
  }
  mdi -t
}


What do you do at the end of the world? Are you busy? Will you save us?