| 
 | 
 
Joined:  Dec 2008 
Posts: 1,483  
Hoopy frood 
 | 
 
OP
 
Hoopy frood 
Joined:  Dec 2008 
Posts: 1,483  | 
Hello,
  I wanna suggest an identifier to return how much aliases are in a "test.mrc" .
  e.g: $isalias(test.mrc).total or $alias(test.mrc).total
  NOTE: I don't know if there is an way to do this but an alias will be helpfull 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Aug 2004 
Posts: 7,168  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Aug 2004 
Posts: 7,168  | 
I'm at work now (on break), so I can't test this, but it seems to me that a simple (pardon the pun) alias that calls the /filter command and returns the results from $filtered would work just fine.
  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Jul 2007 
Posts: 1,124  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Jul 2007 
Posts: 1,124  | 
RusselB is right about the use of filter: alias find {
  var %file = $$1
  window -h @-
  filter -fw %file @- *alias* 
  echo -a $iif($calc($filtered -2) > 1,$v1 matches,$v1 match) found in %file
  close -@-
}Usage: If you have the remote files included in another folder, you may need to include the path to it. The code will check the file you search for in mirc directory.  
Last edited by Tomao; 03/03/11 08:01 PM.
 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Jul 2007 
Posts: 1,124  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Jul 2007 
Posts: 1,124  | 
I've changed the invisible window name to "-" and the alias trigger to find and aliases to match... because with aliases the filter may count it as an alias. 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Jul 2007 
Posts: 1,124  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Jul 2007 
Posts: 1,124  | 
I've edited it again because of a couple of overlooked matters. 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Dec 2002 
Posts: 2,884  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Dec 2002 
Posts: 2,884  | 
alias messup_count {
  echo -a hello blahaliasblah
  alias -r moo
}Your wildcard match is way too general. A regular expression like  /^\s*\/*[!\.]*alias\s+(-l|[^-])/ should do (some quick testing has given correct results).  
Last edited by starbucks_mafia; 03/03/11 08:27 PM.
 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Feb 2006 
Posts: 180  
Vogon poet 
 | 
 
 
Vogon poet 
Joined:  Feb 2006 
Posts: 180  | 
I've edited it again because of a couple of overlooked matters.  ;balias ;calias ;dalias ;alias me return me alias you return you Your alias will match 5 times (3, if you subtract) Using regex is a better choice. Edit:Using starbucks_mafia regex: 
alias find {
  var %file = $scriptdir $+ $$1
  window -h @-
  filter -gfw %file @- /^\s*\/*[!\.]*alias\s+(-l|[^-])/
  echo -sc info * There are $iif($filtered > 1,$v1 matches,$v1 match) found in %file
  close -@-
} 
Last edited by Crinul; 03/03/11 08:33 PM.
 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Jul 2007 
Posts: 1,124  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Jul 2007 
Posts: 1,124  | 
Thanks to starbucks_mafia and Crinul. I didn't think of using regex in the first place. I agree with you two completely.
  Edit - lol Crinul beat me to it.
  
Last edited by Tomao; 03/03/11 08:39 PM.
 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Jul 2007 
Posts: 1,124  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Jul 2007 
Posts: 1,124  | 
Crinul, I think the $filtered still needs to be subtracted by one because of the alias find may get filtered as a count. 
  I mean, if you check the aliases in the same file where the alias is installed...
 
  
Last edited by Tomao; 03/03/11 08:48 PM.
 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Feb 2006 
Posts: 180  
Vogon poet 
 | 
 
 
Vogon poet 
Joined:  Feb 2006 
Posts: 180  | 
No, because that's not the real number of aliases. (I think alias find should be included). 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Jul 2007 
Posts: 1,124  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Jul 2007 
Posts: 1,124  | 
Oh ok. You're correct. Thanks for the clarification.  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Jul 2007 
Posts: 1,124  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Jul 2007 
Posts: 1,124  | 
I think alias find should be included. Yes, it's included. The regex method works like a charm. Thanks you two, once again, for the improvement upon the example provided.  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Dec 2008 
Posts: 1,483  
Hoopy frood 
 | 
 
OP
 
Hoopy frood 
Joined:  Dec 2008 
Posts: 1,483  | 
Good work the code is working correctly! but it will be good to add in mirc by default! 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Apr 2010 
Posts: 964  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Apr 2010 
Posts: 964  | 
Instead of using a window, you could use the -k switch with /noop Also, what about ini files? I haven't extensively tested it but here's my version of it: alias Aliases {
  if (!$isfile($1-)) { return 0 }
  var %m = $iif(*.ini iswm $1-,/^n\d+=\s*\/*alias\b/i,/^\s*\/*alias\b/i)
  filter -fkg $qt($1-) noop %m
  return $filtered
} 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Jul 2007 
Posts: 1,124  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Jul 2007 
Posts: 1,124  | 
What about the .mrc extension? An alias can be made into a remote file. 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Apr 2010 
Posts: 964  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Apr 2010 
Posts: 964  | 
If the specified file is an Ini mine uses the follow regex:   /^n\d+=\s*\/*alias\b/i
  It it doesn't end with .Ini it uses:   /^\s*\/*alias\b/i 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Jul 2007 
Posts: 1,124  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Jul 2007 
Posts: 1,124  | 
Did you edit your post, Froggie? It didn't look like that the last time I saw it. :P At any rate, nice work on the regex. 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Apr 2010 
Posts: 964  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Apr 2010 
Posts: 964  | 
Nope, I didn't edit it. If I did, I would have also fixed all the grammar/spelling mistakes as well(lol). But just for the sake of doing it, here's an even shorter version: alias Aliases {
  if (!$isfile($1-)) { return 0 }
  filter -fkg $qt($1-) noop /^ $+ $iif(*.ini iswm $1-,n\d+=) $+ \s*alias(?: |$)/i               
  return $filtered
}Ok, now that I'm done editing things here, let me make a note. All the snippets presented here have a flaw, though not MAJOR it's still a flaw; they  ALL count aliases commented out with  /**/For the sake of speed and simplicity, even though I realized the bug above, I did it this way. If you'd like a version that DOESN'T count those then hit me back and I might get around to it.  
Last edited by FroggieDaFrog; 04/03/11 07:06 AM.
 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Feb 2006 
Posts: 180  
Vogon poet 
 | 
 
 
Vogon poet 
Joined:  Feb 2006 
Posts: 180  | 
alias messup_count {
  echo -a hello blahaliasblah
  alias -r moo
}Using your alias: 1) * No such identifier: $noop (use other alias for noop $1-??) 2) Result is 2 filter -fkg <filename> !noop /^ $+ $iif(*.ini iswm $1-,n\d+=) $+ \s*\/*[!\.]*alias\s+(-l|[^-])/i !noop prevents mIRC from displaying the * No such identifier message (is it like ~ or a bug?) they ALL count aliases commented out with /**/ Right you are.  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Apr 2010 
Posts: 964  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Apr 2010 
Posts: 964  | 
Last edited by FroggieDaFrog; 04/03/11 03:13 PM.
 
 
 |  
 
 | 
 
 
 |  
 
 
   |  
 
 |