|
Joined: Feb 2006
Posts: 307
Fjord artisan
|
OP
Fjord artisan
Joined: Feb 2006
Posts: 307 |
hello I have this script that hides specific switchbar buttons: 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: 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
|
|
|
|
Joined: Feb 2006
Posts: 307
Fjord artisan
|
OP
Fjord artisan
Joined: Feb 2006
Posts: 307 |
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
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:
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
|
|
|
|
Joined: Feb 2006
Posts: 307
Fjord artisan
|
OP
Fjord artisan
Joined: Feb 2006
Posts: 307 |
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:
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?
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
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
|
|
|
|
Joined: Feb 2006
Posts: 307
Fjord artisan
|
OP
Fjord artisan
Joined: Feb 2006
Posts: 307 |
thanks it works very well I also have this alias: 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
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
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:
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
|
|
|
|
Joined: Feb 2006
Posts: 307
Fjord artisan
|
OP
Fjord artisan
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.
|
|
|
|
Joined: Jun 2006
Posts: 508
Fjord artisan
|
Fjord artisan
Joined: Jun 2006
Posts: 508 |
Try this
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
}
|
|
|
|
Joined: Feb 2006
Posts: 307
Fjord artisan
|
OP
Fjord artisan
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?
|
|
|
|
Joined: Jun 2006
Posts: 508
Fjord artisan
|
Fjord artisan
Joined: Jun 2006
Posts: 508 |
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
}
|
|
|
|
Joined: Feb 2006
Posts: 307
Fjord artisan
|
OP
Fjord artisan
Joined: Feb 2006
Posts: 307 |
umm, it doesnt work 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.
|
|
|
|
Joined: Jun 2006
Posts: 508
Fjord artisan
|
Fjord artisan
Joined: Jun 2006
Posts: 508 |
Seems to work fine for me...:shrugs:
|
|
|
|
Joined: Feb 2006
Posts: 307
Fjord artisan
|
OP
Fjord artisan
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.
|
|
|
|
|