mIRC Homepage
Posted By: pouncer check to see where the alias lies - 03/02/09 12:56 PM
$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?
Posted By: DJ_Sol Re: check to see where the alias lies - 03/02/09 01:17 PM
$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

Posted By: sparta Re: check to see where the alias lies - 03/02/09 01:18 PM
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
  }
}
Posted By: Horstl Re: check to see where the alias lies - 03/02/09 01:45 PM
$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
Posted By: hixxy Re: check to see where the alias lies - 04/02/09 01:40 AM
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.
Posted By: lerpicus Re: check to see where the alias lies - 06/02/09 02:52 AM
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.

© mIRC Discussion Forums