mIRC Home    About    Download    Register    News    Help

Print Thread
how to display folder info or file info #139332 13/01/06 10:18 AM
Joined: Oct 2005
Posts: 75
C
Confuzzled Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Oct 2005
Posts: 75
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?

Re: how to display folder info or file info #139333 13/01/06 10:28 AM
Joined: Nov 2005
Posts: 105
D
drc4 Offline
Vogon poet
Offline
Vogon poet
D
Joined: Nov 2005
Posts: 105
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.

Re: how to display folder info or file info #139334 13/01/06 05:47 PM
Joined: Oct 2005
Posts: 75
C
Confuzzled Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Oct 2005
Posts: 75
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

Re: how to display folder info or file info #139335 13/01/06 06:05 PM
Joined: Nov 2005
Posts: 105
D
drc4 Offline
Vogon poet
Offline
Vogon poet
D
Joined: Nov 2005
Posts: 105
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.

Re: how to display folder info or file info #139336 14/01/06 09:29 AM
Joined: Oct 2005
Posts: 75
C
Confuzzled Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Oct 2005
Posts: 75
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-) ) 
}

Re: how to display folder info or file info #139337 14/01/06 09:56 AM
Joined: Aug 2005
Posts: 525
S
schaefer31 Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
Well, $findfile takes at most 5 parameters and you have 10. Think commas.

Re: how to display folder info or file info #139338 14/01/06 10:02 AM
Joined: Oct 2005
Posts: 75
C
Confuzzled Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Oct 2005
Posts: 75
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?

Re: how to display folder info or file info #139339 14/01/06 10:06 AM
Joined: Aug 2005
Posts: 525
S
schaefer31 Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
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

Re: how to display folder info or file info #139340 14/01/06 10:12 AM
Joined: Oct 2005
Posts: 75
C
Confuzzled Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Oct 2005
Posts: 75
wow that's a long one

Re: how to display folder info or file info #139341 14/01/06 10:18 AM
Joined: Aug 2005
Posts: 525
S
schaefer31 Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
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

Re: how to display folder info or file info #139342 14/01/06 10:19 AM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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.
Re: how to display folder info or file info #139343 14/01/06 10:25 AM
Joined: Oct 2005
Posts: 75
C
Confuzzled Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Oct 2005
Posts: 75
interesting,

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