|
Joined: Oct 2005
Posts: 126
Vogon poet
|
OP
Vogon poet
Joined: Oct 2005
Posts: 126 |
Hi, i've been trying/creating alot, but still didn't found any of them... Where i'm searching for is, when i type: .list C:\Pictures\*.* That it will show all the files in that map to echo in my mIRC like: [ C:\Pictures ` jippii.jpg ] [ C:\Pictures ` jippii2.jpg ] , etc... - Also when i do this: .list C:\Stuff\*.txt (that i will show all the .txt files in the map & this with everything) - Also: .remove C:\Pictures\jippii.jpg & .mkdir C:\testz (so the script will create a directory "Testz") - Thankx anyway 
Last edited by PhyxiuS; 03/05/06 07:40 PM.
|
|
|
|
Joined: Dec 2002
Posts: 3,534
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,534 |
This probably isnt what you want but try:
On *:Input:*: {
if (.list == $1) {
var %x = 1, %sdir = $$sdir= " Select Dir "
while (%x <= $findfile(%sdir,$iif($2,$2,*.*),0)) {
echo -a $+([,$findfile(%sdir,$iif($2,$2,*.*),%x),])
inc %x
}
halt
}
}
|
|
|
|
Joined: Oct 2005
Posts: 126
Vogon poet
|
OP
Vogon poet
Joined: Oct 2005
Posts: 126 |
No, it just has 2 echo the files from the map to my mIRC Window... Without have 2 do anything else, not selecting the map first or somethin'...
|
|
|
|
Joined: Dec 2002
Posts: 3,534
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,534 |
On *:Input:*: {
if (.list == $1) {
tokenize 124 $1-
var %sdir = $gettok($1,$+(2,-,$numtok($1,32)),32)
if (%sdir) {
var %x = 1
while (%x <= $findfile(%sdir,$iif($2,$2,*.*),0)) {
echo -a $+([,$findfile(%sdir,$iif($2,$2,*.*),%x),])
inc %x
}
halt
}
}
}
.list <directory>|<extension> Example: .list C:\mIRC|*.ico Lists all *.ico files. If you don't specify an extension: Example: .list C:\mIRC Lists all files in mIRC. -Andy
|
|
|
|
Joined: Oct 2005
Posts: 126
Vogon poet
|
OP
Vogon poet
Joined: Oct 2005
Posts: 126 |
Works great ! u also know the .remove & .mkdir code? 
|
|
|
|
schaefer31
|
schaefer31
|
Why re-invent the wheel?
/help /remove /help /mkdir
|
|
|
|
Joined: Dec 2002
Posts: 3,534
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,534 |
On *:Input:*: {
tokenize 124 $1-
if (.list == $gettok($1,1,32)) {
echo -a $1-
var %sdir = $gettok($1,$+(2,-,$numtok($1,32)),32)
if (%sdir) {
var %x = 1
while (%x <= $findfile(%sdir,$iif($2,$2,*.*),0)) {
echo -a $+([,$findfile(%sdir,$iif($2,$2,*.*),%x),])
inc %x
}
}
}
elseif (.remove == $gettok($1,1,32)) {
var %sdir = $gettok($1,$+(2,-,$numtok($1,32)),32)
if (%sdir) {
var %x = 1
while (%x <= $findfile(%sdir,$iif($2,$2,*.*),0)) {
remove $+(",$findfile(%sdir,$iif($2,$2,*.*),%x),")
inc %x
}
}
}
elseif (.mkdir == $gettok($1,1,32)) {
$1-
}
}
Untested.
|
|
|
|
Joined: Sep 2005
Posts: 2,630
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,630 |
on *:input:*:{
if ($1 == .list) {
noop $findfile($deltok($2-,-1,92),$gettok($2-,-1,92),0,echo -a $+([,$1-,]))
haltdef
}
elseif ($istok(.mkdir .remove,$1,32)) {
$1-
haltdef
}
} This one will allow the format you asked for (.list c:\test\*.*) and should be a lot faster than SladeKraven's. SladeKraven: Calling $findfile in a loop is bad enough, but calling it twice in a loop is absolutely horrendous. This is what your script does: $findfile within while loop counts all files in the directory. This information isn't stored, it has to count all of the files each time. If you had 1000 files in a directory, all .avi, and he matched .avi, your script would have to count 1000000 files without even considering the second $findfile. First file: This will go through every file until it finds the first matching file. Second file: This will go through every file until it finds the second matching file. Third file: This will go through every file until it finds the second matching file. My version will go through every file once and echo any matches. For huge directories it could be over 1000 times faster.
|
|
|
|
Joined: Oct 2005
Posts: 126
Vogon poet
|
OP
Vogon poet
Joined: Oct 2005
Posts: 126 |
Hmmm, i want 2 use it as command on my Channel Security Bot. So, don't think that "input" stuff is needed... HixxY, i also think u did some mistakes in the script, cuz when i type:
.list C:\Movies\*.*
- Aint working... :s
|
|
|
|
Joined: Oct 2005
Posts: 126
Vogon poet
|
OP
Vogon poet
Joined: Oct 2005
Posts: 126 |
I already tried something by myself:
on *:TEXT:*:#:{
if ($2- == .list) {
noop $findfile($deltok($2-,-1,92),$gettok($2-,-1,92),0,echo -a $+([,$2-,]))
haltdef
}
elseif ($istok(.mkdir .remove,$2-,32)) {
$2-
haltdef
}
}
Aint working
|
|
|
|
Joined: Sep 2005
Posts: 2,630
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,630 |
You modified the code, that's why.. on *:TEXT:*:#:{
if ($1 == .list) {
noop $findfile($deltok($2-,-1,92),$gettok($2-,-1,92),0,echo -a $+([,$2-,]))
haltdef
}
elseif ($istok(.mkdir .remove,$1,32)) {
$2-
haltdef
}
}
|
|
|
|
Joined: Oct 2005
Posts: 126
Vogon poet
|
OP
Vogon poet
Joined: Oct 2005
Posts: 126 |
Hmmm, "noop $findfile" Where is noop standing for?  Isn't it "LOOP" ... 
Last edited by PhyxiuS; 05/05/06 07:05 PM.
|
|
|
|
Joined: Oct 2005
Posts: 126
Vogon poet
|
OP
Vogon poet
Joined: Oct 2005
Posts: 126 |
HixxY, that code aint working either... & the ".mkdir" (to create a directory, like: .mkdir C:\Test123 (aint working) (= (21:07) -› C:\Test123 is an unrecognised command) .remove C:\Test.txt (aint working) (= also an unrecognised command) & i know... The code isn't scripted in ur code HixxY, + the .list aint working either 
|
|
|
|
Joined: Sep 2005
Posts: 2,630
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,630 |
No. noop means "no operation" or "do nothing" - we need to call $findfile but we don't need to do anything with the data it returns, so we use /noop on it.
|
|
|
|
Joined: Sep 2005
Posts: 2,630
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,630 |
My bad, try this: on *:TEXT:*:#:{
if ($1 == .list) noop $findfile($deltok($2-,-1,92),$gettok($2-,-1,92),0,echo -a $+([,$1-,]))
elseif ($istok(.mkdir .remove,$1,32)) $1-
} Make sure you remove any other versions of the script and DON'T modify it this time.
|
|
|
|
Joined: Oct 2005
Posts: 126
Vogon poet
|
OP
Vogon poet
Joined: Oct 2005
Posts: 126 |
That's working. I've got my Security Bot working now, a m8 told me it would be better if i would use sockets for it. I've got a socket security bot running right now. - This is what I've got:
alias list1ng {
if ($1 == .list) noop $findfile($deltok($2-,-1,92),$gettok($2-,-1,92),0,echo -a $+([,$1-,]))
elseif ($istok(.mkdir .remove,$1,32)) $1-
}
if (*:.list* iswm %read) {
do.wr1t3 privmsg %channel : $+ list1ng
}
It aint right, but I tried... - It's like these way cuz it's connected via a socket... I also tried Channel Show/Hide, but it doesn't hide the status bar, so i have 2 keep a second server running for my security bot, I prefer sockets... - When i type: .list C:\blabla\*.* (like before) that it msg's the founded files to the %channel. .mkdir C:\blabla (then msg's to channel: $dir succesfully created, if not created= error) .remove C:\blaaat.txt (msg: $file succesfully removed) - Is this possible?
Last edited by PhyxiuS; 05/05/06 07:56 PM.
|
|
|
|
Joined: Feb 2004
Posts: 2,013
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,013 |
I've pointed out Sladekraven's inefficient usage of $findfile plenty of times, but somehow it doesn't seem to get through to him.
|
|
|
|
Joined: Dec 2002
Posts: 3,534
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,534 |
Blah de blah blah. Aren't you supposed to be gone?
|
|
|
|
DaveC
|
DaveC
|
I would like to point out your inefficient usage of blah, i feel 2 blahs would have done nicely. :-)
|
|
|
|
Joined: Dec 2002
Posts: 3,534
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,534 |
Heh, I got lost in the moment. :tongue:
|
|
|
|
|