mIRC Home    About    Download    Register    News    Help

Print Thread
navigate through visible switchbar buttons #187872 14/10/07 01:23 PM
Joined: Feb 2006
Posts: 307
N
nataliad Offline OP
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Feb 2006
Posts: 307
hello

I have this script that hides specific switchbar buttons:

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(#hellas #jokes-gr #greece #mad #pathfinder,$chan(%y),32) {
      %x $chan(%y)
    }
    inc %y
  }
}


I have this script that navigates using keyboard keys across switchbar buttons:

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(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) %nwin = $numtok(%wlist,44)
  }
  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),")
}


how can I make mirc to navigate only the visible (with the second script) switchbar buttons?

thanks

Re: navigate through visible switchbar buttons [Re: nataliad] #188106 18/10/07 02:14 AM
Joined: Feb 2006
Posts: 307
N
nataliad Offline OP
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Feb 2006
Posts: 307
confused

Re: navigate through visible switchbar buttons [Re: nataliad] #188110 18/10/07 03:08 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
We've been through this before. You have the script set to ignore ALL window types, therefore it will never shift to any windows. If you want it to shift only to channels that are visible, try this script:

Code:
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(status chat custom fserv get send,%wtype,32)) continue
      if ($window(*,%c).state == hidden) 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) %nwin = $numtok(%wlist,44)
  }
  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),")
}



Note that if you view one of the hidden channels (by using the window menubar item) it will be considered unhidden by the script. To resume ignoring that window, you need to rehide it.

-genius_at_work

Re: navigate through visible switchbar buttons [Re: genius_at_work] #188177 18/10/07 10:35 PM
Joined: Feb 2006
Posts: 307
N
nataliad Offline OP
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Feb 2006
Posts: 307
Originally Posted By: genius_at_work
We've been through this before. You have the script set to ignore ALL window types, therefore it will never shift to any windows. If you want it to shift only to channels that are visible, try this script:

Code:
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(status chat custom fserv get send,%wtype,32)) continue
      if ($window(*,%c).state == hidden) 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) %nwin = $numtok(%wlist,44)
  }
  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),")
}



Note that if you view one of the hidden channels (by using the window menubar item) it will be considered unhidden by the script. To resume ignoring that window, you need to rehide it.

-genius_at_work


this script works alone or I need any of the above scripts?

Re: navigate through visible switchbar buttons [Re: nataliad] #188190 19/10/07 12:50 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
The alias I gave you replaces the only that alias in the script you provided. Leave the other aliases unchanged.

-genius_at_work

Re: navigate through visible switchbar buttons [Re: genius_at_work] #188246 19/10/07 06:01 PM
Joined: Feb 2006
Posts: 307
N
nataliad Offline OP
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Feb 2006
Posts: 307
thanks it works very well

I also have this alias:

Code:
F1 /close -m $active | /F3


it closes the current query and then presses F3

but now F3 goes to channel visible windows, so can I make it go to the next query only and not channel or other window? and if there is no other query window, it should go to the next channel window

thanks

Re: navigate through visible switchbar buttons [Re: nataliad] #188267 20/10/07 02:21 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
You would have to duplicate the /shift alias as /shift2 and alter it to do what you want.

Alternatively, you could do something like this:

Code:

F1 {
close -m $active
if ($query(0) <= 0) window -a $+(",$query(1),")
else shift 1
}



This code will go to the FIRST query if one exists, else it will scroll to a channel window.

-genius_at_work

Re: navigate through visible switchbar buttons [Re: genius_at_work] #188365 22/10/07 01:06 AM
Joined: Feb 2006
Posts: 307
N
nataliad Offline OP
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Feb 2006
Posts: 307
thanks

but when I click F1 while at a channel window I get this:

* /window: invalid parameters (line 925, script.ini)

I suppose its normal (since I only want F1 to work while on query), but can I prevent this from appearing?

EDIT: it doesnt work well, when I click F1, it closes the current query and it moves to the next visible channel window, while other queries exist (it should go to one of these queries and only if there are no queries, it should go to the channel)

Last edited by nataliad; 22/10/07 01:08 AM.
Re: navigate through visible switchbar buttons [Re: nataliad] #188376 22/10/07 04:18 AM
Joined: Jun 2006
Posts: 508
D
deegee Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Try this
Code:
F1 {
  if (!$query($active)) { return }
  var %i = 1 | while ($query(%i) != $active) { inc %i }
  close -m $active
  if ($query(%i) || $query(1)) { window -a $v1 }
  else shift 1
}


Re: navigate through visible switchbar buttons [Re: deegee] #188391 22/10/07 06:45 AM
Joined: Feb 2006
Posts: 307
N
nataliad Offline OP
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Feb 2006
Posts: 307
thanks it works very well

can you also make it to go to a query when I hit F1 while on channel?

Re: navigate through visible switchbar buttons [Re: nataliad] #188431 23/10/07 08:37 AM
Joined: Jun 2006
Posts: 508
D
deegee Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Code:
F1 {
  if ($me ison $active) {
    if $query(1) { window -a $v1 }
    return
  }
  if (!$query($active)) { return }
  var %i = 1 | while ($query(%i) != $active) { inc %i }
  close -m $active
  if ($query(%i) || $query(1)) { window -a $v1 }
  else shift 1
}

Re: navigate through visible switchbar buttons [Re: deegee] #188462 23/10/07 08:49 PM
Joined: Feb 2006
Posts: 307
N
nataliad Offline OP
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Feb 2006
Posts: 307
umm, it doesnt work frown

specificaly, it doesnt go to any query if I click F1 while on channel window (even if queries exist)

however, the part that it closes the currect query and goes to another query works well

Last edited by nataliad; 23/10/07 08:51 PM.
Re: navigate through visible switchbar buttons [Re: nataliad] #188503 25/10/07 01:22 AM
Joined: Jun 2006
Posts: 508
D
deegee Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Seems to work fine for me...:shrugs:

Re: navigate through visible switchbar buttons [Re: deegee] #188678 27/10/07 11:58 PM
Joined: Feb 2006
Posts: 307
N
nataliad Offline OP
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Feb 2006
Posts: 307
mm

when you click F1 while on a channel, you are moved to a query?

even if the query has never been opened before? it seems to only go to the query only if it has been previously activated/focused

EDIT:it doesnt seem to work regardless the query have been activated or not

Last edited by nataliad; 28/10/07 12:57 AM.