mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
$isalias(test_alias) returns $true

but how can i get the pathname to the mirc script where this alias lies? can mirc allow us to do this?

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
$isalias(name)

Returns $true if the specified name is an alias command that exists in your aliases or scripts.



Properties: fname, alias



$isalias(join) returns $true if you have an alias for /join

$isalias(join).fname returns the filename in which the alias exists

$isalias(join).alias returns the alias definition for /join


Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
I found this code for you. But you cant have space in the foldername where mirc is located..

Code:
alias findalias {
  ; no such custom alias
  if (!$isalias($1).fname) { echo -a Found no such alias $qt($1) $+ . }

  ; if the custom alias is in a "aliases file": return only the matching filename
  else { 
    var %file = $isalias($1).fname, %nr = 1
    while ($alias(%nr)) {
      if (%file == $v1) {
        echo -a Found alias $qt($1) in alias-file $qt(%file) $+ . As this is no remote, cannot find the exact line anyway.
        return
      }
      inc %nr
    }

    ; if the custom alias is in a "remote file": find the alias and its line number by filtering that remote file 
    var %w = @alias.filter
    window -h %w
    filter -gfwcn %file %w $+(/(alias|alias\s+-l)\s+,$1,\s+/i)

    if ($line(%w,1)) {
      var %line = $v1, %nr = $gettok(%line,1,32), %alias = $gettok(%line,$iif(($gettok(%line,3,32) == -l),2-4,2-3),32)
      echo -a Found $qt(%alias) at line %nr of file $qt(%file)
    }
    else { echo -a Found alias $qt($1) in remote-file $qt(%file) $+ . Cannot find the exact line anyway. }

    window -c %w
  }
}


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
$isalias(aliasname).fname works well for global aliases in remote- and "aliases" files; the code above was an approach to find local aliases and respective line numbers.
The "spaces issue" should be fixed by adding a $qt arround %file in the line "filter -gfwcn %file ..." smile

Last edited by Horstl; 03/02/09 01:48 PM.
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Maybe next time you find an alias like $isalias, you should just quickly check the help file to see if it has any properties that might do what you want.

It's like discovering /echo in the help file, and then asking if there's any way to display a timestamp when you echo text.

Just do a little research and you'll save everyone, most of all yourself, some time.

Joined: Feb 2003
Posts: 106
L
Vogon poet
Offline
Vogon poet
L
Joined: Feb 2003
Posts: 106
I have written a script which lists all aliases used by mirc into a custom listbox.

Double clicking on an alias within the listbox opens up the containing file and takes you to the line within that file that contains the alias definition.

Give me a yell if you think it would be useful to you.



-
Just because it never happened doesn't mean it isn't true.

Link Copied to Clipboard