mIRC Home    About    Download    Register    News    Help

Topic Options
#139332 - 13/01/06 10:18 AM how to display folder info or file info
Confuzzled Offline
Babel fish

Registered: 10/10/05
Posts: 75
Loc: Sparks, Nevada
hello again,

i was just wondering, if it's possible to do some kind of command on a bot for the bot to display infos of a folder in $mircdir, wha'ts in the folder, and what are the exact names of the files in the folder, size of files into $chan or $nick?

Top
#139333 - 13/01/06 10:28 AM Re: how to display folder info or file info
drc4 Offline
Vogon poet

Registered: 22/11/05
Posts: 105
Loc: Dover, Delaware
look in the helpfile under $findfile and $file. For example, to display the files in a folder you can use
Code:
 //echo 1 $findfile($mircdir,*,0,echo $1-) 

to display the size look at
Code:
 $file(filename).size 

Everything you're wanting to do is very possible with the use of those commands. I'm sure there's a dll that could probably speed the task up, just search the boards.

Top
#139334 - 13/01/06 05:47 PM Re: how to display folder info or file info
Confuzzled Offline
Babel fish

Registered: 10/10/05
Posts: 75
Loc: Sparks, Nevada
could you be more specific? i already did read the help $file and $findfile it don't seem to help much i wanted to msg or notice my $mircdir Logs only to nick or channel with what's in Logs folder what are the names how many lines per log file, not echo

Top
#139335 - 13/01/06 06:05 PM Re: how to display folder info or file info
drc4 Offline
Vogon poet

Registered: 22/11/05
Posts: 105
Loc: Dover, Delaware
I'm not sure I understand everything you're wanting to do. But something like this may be what you're wanting.
Code:
on *:TEXT:!logs:?:{
  echo 1 $findfile($mircdirlogs,*.*,0,msg $nick log name: $nopath($1-) - number of lines: $lines($1-) ) 
}

The usage would be someone messaging you with !logs and in return it would show them the name of all the logs in your logs folder, and how many lines are in each file. I used $nopath() so that if only shows the name of the file itself, and not the entire directory. Hope this is what you're asking for, if not, please explain in further detail. Thanks.

Top
#139336 - 14/01/06 09:29 AM Re: how to display folder info or file info
Confuzzled Offline
Babel fish

Registered: 10/10/05
Posts: 75
Loc: Sparks, Nevada
thank you kindly,

it works great but now when i try to put colors on it it stops working and starts saying * Invalid parameters: $findfile

this is how i had it

Code:
on *:TEXT:!logs:#:{  echo -l $findfile($mircdirlogs,*.*,0,msg $chan 1,1 1,14 Log name 1,1  $nopath($1-) - 1,1 1,14 Number of lines 1,1  $lines($1-) ) 
}

Top
#139337 - 14/01/06 09:56 AM Re: how to display folder info or file info
schaefer31 Offline
Fjord artisan

Registered: 27/08/05
Posts: 525
Well, $findfile takes at most 5 parameters and you have 10. Think commas.

Top
#139338 - 14/01/06 10:02 AM Re: how to display folder info or file info
Confuzzled Offline
Babel fish

Registered: 10/10/05
Posts: 75
Loc: Sparks, Nevada
does that mean that i can't use colors and use default code instead? or is it possible if i try to write all those into a txt file with colors and display them instead?

Top
#139339 - 14/01/06 10:06 AM Re: how to display folder info or file info
schaefer31 Offline
Fjord artisan

Registered: 27/08/05
Posts: 525
No, it doesn't mean you can't use colors. It just needs to be done in a different way.

Edit: Code shortened in next post

Top
#139340 - 14/01/06 10:12 AM Re: how to display folder info or file info
Confuzzled Offline
Babel fish

Registered: 10/10/05
Posts: 75
Loc: Sparks, Nevada
wow that's a long one

Top
#139341 - 14/01/06 10:18 AM Re: how to display folder info or file info
schaefer31 Offline
Fjord artisan

Registered: 27/08/05
Posts: 525
I shortened the code.

Code:
on *:TEXT:!logs:#:{
  var %c1 = $+($chr(3),01,$chr(44),01,$chr(32))
  var %c2 = $+($chr(3),01,$chr(44),14,$chr(32))
  echo -l $findfile($mircdirlogs,*.*,0,msg $chan %c1 %c2 Log name %c1  $nopath($1-) - %c1 %c2 Number of lines %c1  $lines($1-)) 
}


Code:
$+($chr(3),01,$chr(44),01,$chr(32))


Is the same as writing
Code:
01,01 


Except it doesn't get treated as a paramter as the latter would.

You should also use double digits when using colors. See my post from this other thread about why: http://forums.mirc.com/s...p;page=0#146664

Top
#139342 - 14/01/06 10:19 AM Re: how to display folder info or file info
FiberOPtics Offline
Hoopy frood

Registered: 05/02/04
Posts: 2019
Loc: Leuven, Belgium
If you put the string with commas in a variable or $N param, and pass this, then all will be fine.

//var %foo = ,,,,,,, | echo -a $mid(%foo,1)

vs

//echo -a $mid(,,,,,,,,1)
_________________________
Gone.

Top
#139343 - 14/01/06 10:25 AM Re: how to display folder info or file info
Confuzzled Offline
Babel fish

Registered: 10/10/05
Posts: 75
Loc: Sparks, Nevada
interesting,

thank you learned something new today that $char() confuses me that's why i never use em but thank you again

Top