|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
With this alias music {
var %ticks = $ticks, %a = 1, %b = $disk(0)
while %a <= %b {
if !$window(@Music) { .window @Music }
if $disk(%a).type == fixed {
noop $findfile($disk(%a).path,*.mp3,0,echo @Music $1-)
}
elseif $disk(%a).type = remote {
noop $findfile($disk(%a).unc,*.mp3,0,echo @music $1-)
}
inc %a
}
%ticks = $calc($ticks - %ticks)
var %lines = $line(@music,0)
echo 11 @music Total lines %lines
echo 4 @music Total time %ticks milliseconds
echo 4 @music Average time $calc(%ticks / %lines)
}
the section regarding the fixed drive(s) works fine, but remote drive(s) have a problem. The information is send to the window, like it's supposed to, but the number of lines is not increased. On my fixed drives, I have about 5000 mp3 files, and on the remote drive I have about 50000. Thus if this code worked as I expected, it should show a total number of lines of about 55000. However, it does not, it shows the 5000 count. Here's hoping someone can figure out what's going on, and what I need to do in order to get a correct count.
|
|
|
|
Joined: Oct 2003
Posts: 3,918
Hoopy frood
|
Hoopy frood
Joined: Oct 2003
Posts: 3,918 |
have you tried using the recommended bracket and operator syntax?
- argv[0] on EFnet #mIRC - "Life is a pointer to an integer without a cast"
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
Could you please point me to where you are referring to, as I can't see anything wrong with the syntax I'm using, and I'm not getting an error message, which I would expect if there was a bracket or syntax error.
|
|
|
|
Joined: Dec 2002
Posts: 2,033
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,033 |
He means this while %a <= %b {
should be this while (%a <= %b) {
- and this if !$window(@Music) { .window @Music }
should be this if (!$window(@Music)) { .window @Music }
-
and this if $disk(%a).type == fixed {
should be this if ($disk(%a).type == fixed) {
-
and this elseif $disk(%a).type = remote
should be this elseif ($disk(%a).type == remote) { Your error is probably here.
-
and this %ticks = $calc($ticks - %ticks)
should be this var %ticks = $calc($ticks - %ticks)
|
|
|
|
Joined: Jan 2007
Posts: 1,156
Hoopy frood
|
Hoopy frood
Joined: Jan 2007
Posts: 1,156 |
Have you used echos to determine what drives are found with $disk? Another thing, why check if the window exists each time through the while loop? Just check to make sure the window is open at the beginning of your alias. alias music {
var %ticks = $ticks, %a = 1, %b = $disk(0)
if !$window(@Music) { .window @Music }
while %a <= %b { So have you verified it has found your network drives?
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
all of the echoing is showing the correct drives, and the echo in the $findfile sends the information to the custom window.
What doesn't seem to be happening, and I guess I didn't make this clear, is the fact that the variable to echo the number of lines from the window seems to be ignoring any lines that come from the remote drive, in spite of the fact that I can see the lines being echoed to the custom window.
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
The problem that I'm encountering with your script is that the echo'd lines seem to exceed the buffer limit on the @window. Even when I change the /echo to /aline, I still get the buffer being exceeded (though at a higher number of lines for some reason).
Maybe try changing the @window to be a listbox (-l switch).
-genius_at_work
Last edited by genius_at_work; 26/09/09 12:51 AM.
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
hmm.. ok, I'll try that and see what happens. In the long run I don't plan on using a custom window, but thought it would be a good way to be able to test my code without ruining the display/conversation flow of my channel windows. So much for that idea. Adding the -l switch made my mIRC lockup. Now possibly I failed to find/read about a switch or other requirement for using a listbox window, but I don't think I did. Here's my current code that locked up mIRC. Removing the -l switch allows the code to work, but with the same problem. alias music {
var %ticks = $ticks, %a = 1, %b = $disk(0)
if !$window(@Music) { .window -l @Music }
while %a <= %b {
echo @Music $disk(%a).path
if $disk(%a).type == fixed {
noop $findfile($disk(%a).path,*.mp3,0,echo @Music $1-)
}
elseif $disk(%a).type = remote {
noop $findfile($disk(%a).unc,*.mp3,0,echo @music $1-)
}
inc %a
}
%ticks = $calc($ticks - %ticks)
var %lines = $line(@music,0)
echo 11 @music Total lines %lines
echo 4 @music Total time %ticks milliseconds
echo 4 @music Average time $calc(%ticks / %lines)
}
Last edited by RusselB; 26/09/09 04:47 AM.
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
You might be able to write the results to a txt file rather than a @window. The file handler commands (/fopen /fwrite etc) should be much faster than /write.
-genius_at_work
|
|
|
|
|