mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
c0mm4nds #148318 03/05/06 07:39 PM
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
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 grin

Last edited by PhyxiuS; 03/05/06 07:40 PM.

If you mess with the best, u will die like the rest !
Re: c0mm4nds #148319 03/05/06 07:58 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
This probably isnt what you want but try:

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

Re: c0mm4nds #148320 03/05/06 08:10 PM
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
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'...


If you mess with the best, u will die like the rest !
Re: c0mm4nds #148321 03/05/06 08:18 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
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

Re: c0mm4nds #148322 03/05/06 08:55 PM
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Oct 2005
Posts: 126
Works great ! u also know the .remove & .mkdir code? confused


If you mess with the best, u will die like the rest !
Re: c0mm4nds #148323 03/05/06 09:09 PM
Joined: Aug 2005
Posts: 525
S
schaefer31 Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
Why re-invent the wheel?

/help /remove
/help /mkdir

Re: c0mm4nds #148324 03/05/06 09:17 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
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 &lt;= $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 &lt;= $findfile(%sdir,$iif($2,$2,*.*),0)) {
        remove $+(",$findfile(%sdir,$iif($2,$2,*.*),%x),")
        inc %x
      }
    }
  }
  elseif (.mkdir == $gettok($1,1,32)) {
    $1-
  }
}


Untested.

Re: c0mm4nds #148325 04/05/06 10:35 AM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
Code:
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.

Re: c0mm4nds #148326 04/05/06 08:35 PM
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
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


If you mess with the best, u will die like the rest !
Re: c0mm4nds #148327 04/05/06 08:41 PM
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Oct 2005
Posts: 126
I already tried something by myself:

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


If you mess with the best, u will die like the rest !
Re: c0mm4nds #148328 05/05/06 12:01 AM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
You modified the code, that's why..

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

Re: c0mm4nds #148329 05/05/06 07:04 PM
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Oct 2005
Posts: 126
Hmmm,

"noop $findfile"

Where is noop standing for? crazy

Isn't it "LOOP" ... confused

Last edited by PhyxiuS; 05/05/06 07:05 PM.

If you mess with the best, u will die like the rest !
Re: c0mm4nds #148330 05/05/06 07:12 PM
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
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 shocked


If you mess with the best, u will die like the rest !
Re: c0mm4nds #148331 05/05/06 07:12 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
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.

Re: c0mm4nds #148332 05/05/06 07:15 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
My bad, try this:

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

Re: c0mm4nds #148333 05/05/06 07:54 PM
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
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:
Code:
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.

If you mess with the best, u will die like the rest !
Re: c0mm4nds #148334 06/05/06 02:34 AM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
I've pointed out Sladekraven's inefficient usage of $findfile plenty of times, but somehow it doesn't seem to get through to him.


Gone.
Re: c0mm4nds #148335 06/05/06 03:32 AM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Blah de blah blah. Aren't you supposed to be gone?

Re: c0mm4nds #148336 06/05/06 07:50 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I would like to point out your inefficient usage of blah, i feel 2 blahs would have done nicely. :-)

Re: c0mm4nds #148337 06/05/06 07:51 AM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Heh, I got lost in the moment. :tongue:

Page 1 of 2 1 2