hello

I have a script that hides specific windows and a script that will navigate to the next (right) or previous (left) window, using keyboard shortcuts

can you tell me how can I make it navigate through the visible windows, and not through all the windows?

thanks

here is the script that hides specific windows:

Code:
alias F8 {
  scon -a toggletabs %hidden
  if (%hidden == $null) set %hidden 1
  else unset %hidden
}
alias -l toggletabs {
  set %x window $iif($0,-w,-h)
  set %y 1
  %x "Status Window"
  while $chan(%y) {
    if $istok(#channel1 #channel2,$chan(%y),32) {
      %x $chan(%y)
    }
    inc %y
  }
}

here are two scipts that do the same job, they navigate through the windows that exist (either visible or not) using F2,F3 keys

I 'd be grateful to comment on which is better

Code:
alias F2 shift -1
alias F3 shift 1
alias shift {
  ; 1: <1=left 0=same >1=right
  ;
  var %wname, %wlist, %wtype, %ccid = $cid, %cwin = $active
  var %a = 0, %aa = $scon(0), %c = 0, %cc = 0, %n = 0, %nwin = 0
  while (%a < %aa) {
    inc %a
    scon %a
    %c = 0
    %cc = $window(*,0)
    while (%c < %cc) {
      inc %c
      %wtype = $window(*,%c).type
      if ($istok(chat custom fserv get send,%wtype,32)) continue
      ;if ($istok(channel status chat custom fserv get send,%wtype,32)) continue
      %wname = $window(*,%c)
      inc %n
      if ((%ccid == $cid) && (%cwin == %wname)) %nwin = %n
      %wlist = $addtok(%wlist,$+($cid,.,%wname),44)
    }
    scon -r
  }
  ;
  if (%nwin == 0) {
    %nwin = $findtok(%wlist,$wildtok(%wlist,$+($cid,.*),1,44),1,44)
    %nwin = $calc(%nwin + $wildtok(%wlist,$+($cid,.*),0,44))
    if ($1 > 0) dec %nwin
  }
  if ($1 < 0) {
    dec %nwin
    if (%nwin == 0) dec %nwin
  }
  elseif ($1 > 0) {
    inc %nwin
    if (%nwin == 0) inc %nwin
  }
  %nwin = $calc(((%nwin - 1) % $numtok(%wlist,44)) + 1)
  %nwin = $gettok(%wlist,%nwin,44)
  if (%nwin != $null) scid $gettok(%nwin,1,46) window -a $+(",$gettok(%nwin,2,46),")
}

or
Code:
alias F3 { 
  var %i = 1 
  while ($window(*,%i)) { 
    if ($window(*,%i) == $active) { 
      inc %i 
      if (!$window(*,%i)) { 
        var %o = 1 
        while ($scon(%o)) { 
          if ($scon(%o) == $cid) { inc %o | if ($scon(%o)) { scon %o window -a "Status Window" | scon %o } | else { scon 1 | window -a "Status Window" } } 
          inc %o 
        } 
      } 
      else { window -a $+(",$window(*,%i),") } 
      break 
    } 
    inc %i 
  } 
} 

alias F2 { 
  var %i = $window(*,0) 
  while ($window(*,%i) !isnum) { 
    if ($window(*,%i) == $active) { 
      dec %i 
      if ($window(*,%i) isnum) { 
        var %o = $scon(0) 
        while ($scon(%o)) { 
          if ($scon(%o) == $cid) { dec %o | if ($scon(%o) != $scon(0)) { scon %o | window -a $window(*,$window(*,0)) } | else { scon $scon(0) | window -a "Status Window" } } 
          dec %o 
        } 
      } 
      else { window -a $+(",$window(*,%i),") } 
      break 
    } 
    dec %i 
  } 
}

Last edited by nataliad; 22/01/07 02:07 AM.