|
Joined: Oct 2003
Posts: 68
Babel fish
|
OP
Babel fish
Joined: Oct 2003
Posts: 68 |
I have a lot of aliases in the file customaliases.ini
is there a way to make a doskey-like system that allows me to type only the first letter and complete the word with TAB key?
example:
I have the aliases "car", "cedar" and "couch" ....
i type /c then press TAB, and for each TAB press /c changes in
/car -----> /cedar -----> /couch
just like it happens typing a nick of the nicklist of a channell
thank you
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
I don't think we're able to do that I do think that it would be a great feature to have, an easy way to sort through our aliases. I did however come up with this,
alias getalias {
var %x = $lines(customaliases.ini)
while (%x) {
if ($left($gettok($read(customaliases.ini,%x),2,61),1) == $1) {
if ($window(@aliases)) {
aline @aliases $gettok($gettok($read(customaliases.ini,%x),2,61),1,32)
}
else {
window -l @aliases
aline @aliases $gettok($gettok($read(customaliases.ini,%x),2,61),1,32)
}
}
dec %x
}
}
on 1:Keydown:@aliases:*: {
if ($keychar isalpha) {
dline @aliases 1- $+ $line(@aliases,0)
getalias $keychar
}
}
menu @aliases {
dclick: {
/ $+ $line(@aliases,$1)
}
}
Excuse the crap coding, basically all this does is sorts through your aliases by the first letter. /getalias w Writes all the aliases beginning with w into the window, I added another little part that when you double click the alias in the window it tries to perform the command. Nothing too fancy but I helps you in one way or another.
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
This doesn't do exactly what you want, but it's pretty close. If you type /cl and /clear appears in the editbox, you'll have to expand your search term to get anything else, so say you wanted to get /close you would type /clo instead of /cl. You use F2 instead of the tab key. alias F2 {
hadd -m autocomplete 1 abook ajinvite alias aline ame amsg anick aop auser avoice away background ban bcopy beep bread break breplace bset btrunc $&
bunset bwrite channel clear clearall cline clipboard close cnick color colour comclose comopen comreg continue copy creq ctcpreply ctcps $&
dcc dccserver dde ddeserver debug dec describe did didtok disable disconnect dlevel dline dll dns dqwindow drawcopy drawdot drawfill
hadd -m autocomplete 2 drawline drawpic drawrect drawreplace drawrot drawsave drawscroll drawtext ebeeps echo editbox emailaddr enable events exit $&
fclose filter findtext finger firewall flash flist flood flush flushini font fopen fseek fsend fserve fullname fwrite ghide gload gmove $&
gopts goto gplay gpoint gqreq groups gshow gsize gstop gtalk gunload guser hadd halt haltdef hdec hdel help hfree hinc hload hmake hop
hadd -m autocomplete 3 hsave ial ialclear ialmark identd if ignore iline inc invite iuser join kick linesep links list load loadbuf localinfo log $&
mdi me mkdir mode msg nick notice notify omsg onotice part partall pdcc perform play playctrl pop protect pvoice qme qmsg query queryrn $&
quit raw reload remini remote remove rename renwin reseterror resetidle return rlevel rline rmdir run ruser save savebuf saveini say scid
hadd -m autocomplete 4 scon server set showmirc signal sline sockaccept sockclose socklist socklisten sockmark sockopen sockread sockrename sockudp $&
sockwrite sound speak splay sreq strip timer timestamp titlebar tnick tokenize topic tray ulist unload unset unsetall updatenl url uwho $&
var vcadd vcmd vcrem vol while whois window winhelp write writeini
var %i = 1, %s, %s2 = $regsub($editbox($active),/\//g,,%s), %s3 = $count($editbox($active),/), %r2
while ($hget(autocomplete,%i)) {
if ($wildtok($hget(autocomplete,%i),$+(%s,*),1,32)) {
%r2 = $v1
.break
}
inc %i
}
if (!%r2) {
var %i = 1, %i2, %r, %r2, %s, %s2 = $regsub($editbox($active),/\//g,,%s), %s3 = $count($editbox($active),/)
while ($alias(%i)) {
if ($fopen(autocomplete)) { .fclose autocomplete }
.fopen autocomplete $+(",$alias(%i).fname,")
while (!$feof) && (!%r2) {
%r = $fread(autocomplete)
if ($regex(%r,/^(?:n\d+=)( $+ %s $+ \S+) .+$/)) && (!%i2) {
%r2 = $regml(1)
.break
}
inc %i2 $count(%r,{)
dec %i2 $count(%r,})
}
if ($fopen(autocomplete)) { .fclose autocomplete }
inc %i
}
if (!%r2) {
var %i = 1, %i2, %r, %r2, %s, %s2 = $regsub($editbox($active),/\//g,,%s), %s3 = $count($editbox($active),/)
while ($script(%i)) {
if ($fopen(autocomplete)) { .fclose autocomplete }
.fopen autocomplete $+(",$script(%i).fname,")
while (!$feof) && (!%r2) {
%r = $fread(autocomplete)
if ($regex(%r,/^(?:n\d+=)?alias ( $+ %s $+ \S+) .+$/)) && (!%i2) {
%r2 = $regml(1)
.break
}
inc %i2 $count(%r,{)
dec %i2 $count(%r,})
}
if ($fopen(autocomplete)) { .fclose autocomplete }
inc %i
}
}
}
editbox -af $iif(%r2,$+($str(/,%s3),%r2),$editbox($active))
.hfree autocomplete
} The code's messy because I made it pretty quickly, i'll see if I can clear it up and i'll post the new one later.
New username: hixxy
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Nice..
|
|
|
|
Joined: Oct 2003
Posts: 68
Babel fish
|
OP
Babel fish
Joined: Oct 2003
Posts: 68 |
thanks guys, you helped me even though I said that is a doskey-like system, while I rememberd that doeskey DIDN'T do a thing like that :tongue:
I'll try this stuff, but still wait for something "final"....it really could be an interesting feature....
thanks again
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Your welcome. Maybe try posting this in the feature section, I personally wouldn't mind seeing it added, the work arounds myself and tidy coded don't match your specifications, what can I say they are [u[almost[/u] the same. I didn't try tidy's version, the code was too long for me to bother with it. After all, we have this feature when pressing tab in the channel cycling through nicknames, so yah, it'd be a good asset IMO.
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
alias -l window.name {
var %window.name = @Command.Tabber
if ($window(%window.name) != %window.name) { window -edoSl600 %window.name | .enable #command.tabber }
return %window.name
}
alias -l add.all.hardcodes {
load.hardcodes abook ajinvite alias aline ame amsg anick aop auser avoice away background ban bcopy beep bread break breplace bset btrunc bunset
load.hardcodes bwrite channel clear clearall cline clipboard close cnick color colour comclose comopen comreg continue copy creq ctcpreply ctcps
load.hardcodes dcc dccserver dde ddeserver debug dec describe did didtok disable disconnect dlevel dline dll dns dqwindow drawcopy drawdot drawfill
load.hardcodes drawline drawpic drawrect drawreplace drawrot drawsave drawscroll drawtext ebeeps echo editbox emailaddr enable events exit fclose
load.hardcodes filter findtext finger firewall flash flist flood flush flushini font fopen fseek fsend fserve fullname fwrite ghide gload gmove
load.hardcodes gopts goto gplay gpoint gqreq groups gshow gsize gstop gtalk gunload guser hadd halt haltdef hdec hdel help hfree hinc hload hmake
load.hardcodes hop hsave ial ialclear ialmark identd if ignore iline inc invite iuser join kick linesep links list load loadbuf localinfo log mdi
load.hardcodes me mkdir mode msg nick notice notify omsg onotice part partall pdcc perform play playctrl pop protect pvoice qme qmsg query queryrn
load.hardcodes quit raw reload remini remote remove rename renwin reseterror resetidle return rlevel rline rmdir run ruser save savebuf saveini say
load.hardcodes scid scon server set showmirc signal sline sockaccept sockclose socklist socklisten sockmark sockopen sockread sockrename sockudp
load.hardcodes sockwrite sound speak splay sreq strip timer timestamp titlebar tnick tokenize topic tray ulist unload unset unsetall updatenl url
load.hardcodes uwho var vcadd vcmd vcrem vol while whois window winhelp write writeini
}
alias -l load.hardcodes {
while ($1) {
aline -nl $window.name $1
aline -nl $window.name / $+ $1
aline -nl $window.name // $+ $1
tokenize 32 $2-
}
}
alias -l scan.alias.file {
var %lb $chr(123), %rb $chr(125), %sb.star.sb $chr(91) $+ * $+ $chr(93), %sb.aliases.sb $chr(91) $+ aliases $+ $chr(93)
if ($right($1-,4) != .ini) { var %ini = $false }
else { var %ini = $true | var %aliases $false }
if ($fopen(autocomplete)) { .fclose autocomplete }
.fopen autocomplete $+(",$1-,")
var %i2 = 0
while (!$feof) {
var %r = $fread(autocomplete)
if (%ini) {
if (%sb.star.sb iswm %r) {
if (%r == %sb.aliases.sb) { var %aliases $true | var %r = $null }
else { var %aliases $false | var %r = $null }
}
elseif (%aliases) {
if (n?*=* iswm %r) { var %r = $gettok(%r,2-,61) }
else { var %r = $null }
}
else { var %r = $null }
}
if (;* iswm $remove(%r,$chr(32))) { var %r = $null }
if (%r != $null) {
if (!%i2) {
if (($left(%r,1) != $chr(32)) && ($left(%r,1) != %rb)) {
while (/* iswm %r) { var %r = $mid(%r,2) }
var %c = $gettok(%r,1,32)
if ($isalias(%c)) {
aline -nl $window.name %c
aline -nl $window.name / $+ %c
aline -nl $window.name // $+ %c
}
}
}
inc %i2 $count(%r,%lb)
dec %i2 $count(%r,%rb)
}
}
if ($fopen(autocomplete)) { .fclose autocomplete }
}
alias -l scan.script.file {
var %lb $chr(123), %rb $chr(125), %sb.star.sb $chr(91) $+ * $+ $chr(93), %sb.script.sb $chr(91) $+ script $+ $chr(93)
if ($right($1-,4) != .ini) { var %ini = $false }
else { var %ini = $true | var %script $false }
if ($fopen(autocomplete)) { .fclose autocomplete }
.fopen autocomplete $+(",$1-,")
var %i2 = 0
while (!$feof) {
var %r = $fread(autocomplete)
if (%ini) {
if (%sb.star.sb iswm %r) {
if (%r == %sb.script.sb) { var %script $true | var %r = $null }
else { var %script $false | var %r = $null }
}
elseif (%script) {
if (n?*=* iswm %r) { var %r = $gettok(%r,2-,61) }
else { var %r = $null }
}
else { var %r = $null }
}
if (;* iswm $remove(%r,$chr(32))) { var %r = $null }
if (%r != $null) {
if (!%i2) {
if (alias * iswm %r) {
var %r = $mid(%r,7)
while (/* iswm %r) { var %r = $mid(%r,2) }
var %c = $gettok(%r,1,32)
if ((%c != -l) && ($isalias(%c))) {
aline -nl $window.name %c
aline -nl $window.name / $+ %c
aline -nl $window.name // $+ %c
}
}
}
}
inc %i2 $count(%r,%lb)
dec %i2 $count(%r,%rb)
}
if ($fopen(autocomplete)) { .fclose autocomplete }
}
#command.tabber off
on *:ACTIVE:*:{
if (($$lactive == $window.name) && (!$editbox($$active)) && ($editbox($lactive))) { editbox -a $editbox($lactive) | editbox $lactive $null }
if (($$active == $window.name) && ($editbox($$lactive)) && (!$editbox($active))) { editbox -a $editbox($lactive) | editbox $iif(($numtok($lactive,32) != 1),-s,$lactive) $null }
halt
:error | reseterror
}
on *:CLOSE:$($window.name):{ echo -st BLAH | .disable #command.tabber }
#command.tabber end
alias COMMAND.TABBER {
clear -l $window.name
add.all.hardcodes
var %i = 1,
while ($alias(%i)) {
scan.alias.file $alias(%i).fname
inc %i
}
var %i = 1,
while ($script(%i)) {
scan.script.file $script(%i).fname
inc %i
}
}
alias MINE.TABBER {
clear -l $window.name
add.all.hardcodes
scan.alias.file customaliases.ini
}
The above creates a seperate window, that u can use TAB in to complete any known aliases or internal commands, its simply using mircs internal TAB completor and has a list of all the commands in the window. Give that a try, it started off so simple an idea and got more complexe as i went becuase i realized some commands wouldnt work due to it being a sepearte window, where they might requeire you to type them in the channel or window of choice, so i added a click in click out system Say your in #somechannel and you have typed "/gre" you click into the command.tabber window and assuming its empty if cuts and pastes "/gre" into it, u can compelte the command and either hit enter, if the command can be entered there, or click back to the window u must enter it in, and it well place the command back into that window. *** Now one thing i did, was once the windows created the first time, I shrunk it down to only the titlebar and the editbox since the rest isnt needed to be seen, and right clicked and saved its position, so from then on it well appear like that.Also if u dont want it as desktop or as ontop then take the d and o out of the window command on line 3 ie "window -eSl600 %window.name" Its not as good as staying in one window and having TAB compelte commands but its close. run /COMMAND.TABBER It well scan all your alias and remotes files for aliases also adds internal commands or RUN /MINE.TABBER and its internal commands and your alias file Credit to TidyTrax for his code which i started with for gathering the alias names, and ended up hacking up alot, but the base was his, also for his nice list of internal commands which i outrightly copied cause i sure know i wasnt going to type em all in. PS : if u dont like the window name @Command.Tabber change it its on line 2, just leave the @ in PSS: to anyone else looking at this, have a go, make it break, damn im sure it well pretty easy, its biggest failure i think is in gathering the aliases, differnent coding formats are bound to have it goofing up.
|
|
|
|
|