mIRC Home    About    Download    Register    News    Help

Print Thread
example #39472 03/08/03 05:41 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
Code:
alias getmp3 {
  var %mp3.dir C:\Documents and Settings\MAT\My Documents\mats folder\My Music\
  $findfile(%mp3.dir,$+(*,$1,*,.mp3),0,echo -a $nopath($1-))
}


i type: /getmp3 tidy
it returns:
tidy boys - bits and pieces.mp3
tidy boys - chainsaw.mp3
tidy boys - cant top it.mp3
tidy boys - colours.mp3
tidy boys - devotion.mp3
tidy boys vs tidy girls - blow ya load.mp3
tidy boys - dance 2 the house.mp3
-
* /7: not connected to server (line 7, script.ini)
line 7 = $findfile line

(this last line does not allow me to make a while loop for such a situation which is what i need it for)


new username: tidy_trax
Re: example #39473 03/08/03 05:48 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Thats because $findfile returns a value. You have to store the value somewhere, or do something with it.

alias getmp3 {
var %mp3.dir C:\Documents and Settings\MAT\My Documents\mats folder\My Music\
.echo -q $findfile(%mp3.dir,$+(*,$1,*,.mp3),0,echo -a $nopath($1-))
}

Re: example #39474 03/08/03 06:12 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
i know that but i dont see why it returns 7 at all....


new username: tidy_trax
Re: example #39475 03/08/03 06:21 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Because it returns the number of files matched. lets do some counting, shall we?

tidy boys - bits and pieces.mp3 -1
tidy boys - chainsaw.mp3 - 2
tidy boys - cant top it.mp3 - 3
tidy boys - colours.mp3 - 4
tidy boys - devotion.mp3 - 5
tidy boys vs tidy girls - blow ya load.mp3 - 6
tidy boys - dance 2 the house.mp3 - 7

7, 7 matched files. I don't see why that is so hard to grasp.

Re: example #39476 03/08/03 08:56 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
i also noticed that but shouldnt it have a switch or something........


new username: tidy_trax
Re: example #39477 03/08/03 09:30 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Code:
alias getmp3 {
  var %mp3.dir C:\Documents and Settings\MAT\My Documents\mats folder\My Music\
  .echo -q $findfile(%mp3.dir,$+(*,$1,*,.mp3),0,echo -a $nopath($1-))
}

Re: example #39478 03/08/03 09:34 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
now it echos a 7 on the last line anyway....


new username: tidy_trax
Re: example #39479 03/08/03 09:37 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
If it echo's a 7 then you either have an echo alias or have copied it wrong, probably by accidentally removing the . in the .echo command.

Many scripts use the exact same way of doing things, which is why it was mentioned in this Feature Suggestion.

Edit: I also just noticed that codemastr posted the exact same script..

Re: example #39480 04/08/03 01:59 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
i copied and pasted codemastr's which echo's 7 at the end.
wont .echo -q make it wait till after the findfile command then echo the number of matches


new username: tidy_trax
Re: example #39481 04/08/03 02:15 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Code:
alias getmp3 { 
var %mp3.dir = C:\Documents and Settings\MAT\My Documents\mats folder\My Music\ 
.!echo -q $findfile(%mp3.dir,$+(*,$1,*,.mp3),0,echo -a $nopath($1-))
}


There is no way in hell that that alias will echo the number of matches. The -q switch means that the /echo will be silent (won't echo) if there's a . prefixed before it. The ! is there to make sure it uses the built-in /echo and not any aliases for /echo you might have. If that echoes the number of matches then you're either doing something very wrong or your computer has issues.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: example #39482 04/08/03 02:16 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
just like i said, i pasted it exactly......


new username: tidy_trax
Re: example #39483 04/08/03 02:23 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
If you pasted my exact code, fixed the newlines (sometimes when you paste it will be put all on one line), and you're still getting the number of matches then there's something very wrong. It's possible you've got another alias by the same name, so use the search feature to check that isn't the case. Otherwise... all I can recommend is that you reinstall mIRC. There's nothing else I can do to help.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: example #39484 04/08/03 02:28 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
if you noticed my posts in scripts n popups you would notice i quit mirc, so therefore ive only just reinstalled and this is my only file loaded.


new username: tidy_trax
Re: example #39485 04/08/03 03:29 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Then apparantly it works for everyone but you, since the same method is used for hundreds of scripts (many very popular ones).

Remove the alias and type //echo -a $isalias(getmp3), perhaps you have an old version of the alias still loaded?

Re: example #39486 04/08/03 03:47 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
nope i have 1 file loaded, with 2 aliases, the other is to loop through using /getmp3 so i can use it like /listmp3 a t f
which would do: /getmp3 a,/getmp3 t,/getmp3 f.
fixed it now.

Last edited by pheonix; 04/08/03 04:32 PM.

new username: tidy_trax