mIRC Home    About    Download    Register    News    Help

Print Thread
incorrect count of lines in custom window #215594 25/09/09 06:12 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
With this
Code:
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.

Re: incorrect count of lines in custom window [Re: RusselB] #215596 25/09/09 06:27 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
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"
Re: incorrect count of lines in custom window [Re: argv0] #215598 25/09/09 07:37 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
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.


Re: incorrect count of lines in custom window [Re: RusselB] #215601 25/09/09 01:12 PM
Joined: Dec 2002
Posts: 2,021
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,021

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)

Re: incorrect count of lines in custom window [Re: RusselB] #215603 25/09/09 04:59 PM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
Hoopy frood
Offline
Hoopy frood
D
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.

Code:
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?


Re: incorrect count of lines in custom window [Re: DJ_Sol] #215612 25/09/09 10:59 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
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.

Re: incorrect count of lines in custom window [Re: RusselB] #215614 26/09/09 12:43 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
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.
Re: incorrect count of lines in custom window [Re: genius_at_work] #215618 26/09/09 04:18 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
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.
Code:
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.
Re: incorrect count of lines in custom window [Re: RusselB] #215620 26/09/09 04:55 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
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