mIRC Home    About    Download    Register    News    Help

Print Thread
#119979 11/05/05 09:47 PM
Joined: Jan 2003
Posts: 62
Attila Offline OP
Babel fish
OP Offline
Babel fish
Joined: Jan 2003
Posts: 62
i want to list all files with $findfile in a window -l
but somebody says me that remove the double space, how can i contourn it?
plzzz

#119980 11/05/05 10:08 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
$findfile and and -l Windows works fine for me?

Code:
alias files {
  var %x = $findfile($1-,*.*,0)
  while (%x) {
    if (!$window(@list)) window -lC @list
    aline -i @list $findfile($1-,*.*,%x)
    dec %x
  }
}


/files <Path>

/files C:\Program Files\mIRC

Can't see nothing wrong with the list. smile

-Andy

#119981 11/05/05 10:34 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Just a small tip regarding your usage of $findfile.

A lot of people use the similar, and very unefficient approach of creating a while loop with $findfile, ignoring the fact that you can supply a command as a parameter of the $findfile identifier, thus creating an internal loop. Even better, if you want to output the files to a custom window, you can just specify the name of that window.

window -l @test
!.echo -q $findfile(<path>,*,0,@test)


Gone.
#119982 11/05/05 10:35 PM
Joined: Jan 2003
Posts: 62
Attila Offline OP
Babel fish
OP Offline
Babel fish
Joined: Jan 2003
Posts: 62
try /files c:\windows\da <-long space.exe
it replace it to c:\windows\da <-long space.exe

#119983 12/05/05 05:08 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
FiberOptics method produces the dual (or more spaces), slades Doesnt but thats due to how mirc deals with spaces, not his code If he had put
aline -i @list $replace($findfile($1-,*.*,%x),$chr(32),$chr(32) $+ )
It would have looked right, but had hidden characters in it, so you would have needed to $strip() the value, and still there a problem to deal with (see below)

One thing you need to be aware of sometimes is when you echo something if it has two consecutive spaces in it it well only echo one, but the value well still have two.
example
Code:
//set -s %x A $+ $chr(32) $+ $chr(32) D
* Set %x to A  D
//echo -a %x
A D
//echo -a $len(%x)
4
//echo -a $replace(%x,$chr(32),^)
A^^D

As you can see the spaces are there just not visable.

I do however find there is alot of times you might have problems writing to the file with commands like /WRITE /FOPEN /FILTER etc as the filename well have the consecutive spaces made into one, unless you use $shortfn(%filenamevar)

This commands is a bit dodgy on non existing filenames, but how often well you event need to make a dual spaced filename.

To anyone out there, anyone got a clean method of making a filename with two consecutive spaces (im letting myself in for ridicule here theres bound to be a simple way i missed)
Mine is such a kludge I dont want to mention it.

#119984 12/05/05 01:24 PM
Joined: Jan 2003
Posts: 62
Attila Offline OP
Babel fish
OP Offline
Babel fish
Joined: Jan 2003
Posts: 62
ok thanx everyone
i've use $findfile(...,@window)
instead of aline $replace($1-,....)


Link Copied to Clipboard