mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#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 !
#148319 03/05/06 07:58 PM
Joined: Dec 2002
Posts: 3,547
S
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
  }
}

#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 !
#148321 03/05/06 08:18 PM
Joined: Dec 2002
Posts: 3,547
S
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

#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 !
#148323 03/05/06 09:09 PM
Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
Why re-invent the wheel?

/help /remove
/help /mkdir

#148324 03/05/06 09:17 PM
Joined: Dec 2002
Posts: 3,547
S
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.

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

#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 !
#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 !
#148328 05/05/06 12:01 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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  
  }
}

#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 !
#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 !
#148331 05/05/06 07:12 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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.

#148332 05/05/06 07:15 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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.

#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 !
#148334 06/05/06 02:34 AM
Joined: Feb 2004
Posts: 2,019
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.
#148335 06/05/06 03:32 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Blah de blah blah. Aren't you supposed to be gone?

#148336 06/05/06 07:50 AM
Joined: Sep 2003
Posts: 4,230
D
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. :-)

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

#148338 06/05/06 08:01 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
You would have to do something like this:

Code:
alias list1ng {
   if ($1 == .list) noop $findfile($deltok($2-,-1,92),$gettok($2-,-1,92),0,do.wr1t3 privmsg %channel $+(:[,$1-,])) 
  elseif ($istok(.mkdir .remove,$1,32)) $1-
}


Code:
tokenize 32 %read
if ($mid($4,2) == .list) list1ng $mid($4-,2)
elseif ($istok(.remove .mkdir,$mid($4,2),32)) $mid($4-,2)


The above code would have to go inside of your on sockread event.

#148339 06/05/06 10:43 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Whether I'm gone or not is irrelevant.

Now, if you simply didn't know about how to use $findfile properly, then someone would perhaps point this out more gently, but when you've been told this atleast 5 times by me, and no doubt probably by some others as well, then that just shows your unwillingness to listen and improve. This is not a personal attack, it's simply the truth. You know it, and I know it.

You are probably wondering why this matters? When you post code here, you should remember you are posting on public forums, where multiple people can see your code. Learning scripting involves a lot of seeing other people's code, and looking at how they get things done. I've used the Search feature extensively when learning scripting, seeing how other scripters did things. However, if you set a bad example, some will follow you in that bad example, from which no one benefits at all, on the contrary.

Think about it, when you learn scripting, programming, or anything for that matter, would you prefer to see badly written examples, or well written examples?


Gone.
#148340 06/05/06 07:10 PM
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Oct 2005
Posts: 126
Well, uuhm... Nice conversation smile

But can someone try to solve my problem? :tongue:


If you mess with the best, u will die like the rest !
#148341 06/05/06 07:13 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Try reading the replies!

#148342 06/05/06 07:18 PM
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Oct 2005
Posts: 126
Already did, just didn't saw the "page: 2"


If you mess with the best, u will die like the rest !
#148343 06/05/06 07:51 PM
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Oct 2005
Posts: 126
HixxY, the code aint working, and i putted it all 100% right.
It's something like this:

Code:
  if (%list == bla || %mkdir == bla || %r3move == bla)  { do.writ3 privmsg %channel : $+ $read(%list) &amp; if ($readed == %list) { (show the requested list of files) &amp; if = mkdir (create dir) &amp; if remove (removedir)  }


So, actually, the %list becomes the script u created... But just in 1 simple word "%list" ... ;\

This code is totally wrong, but I just don't know how to do it...

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

If you mess with the best, u will die like the rest !
#148344 06/05/06 08:06 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Hmm I told you how it should be done. If you don't know how to edit a script I can't really help you.

#148345 06/05/06 10:39 PM
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Oct 2005
Posts: 126
Anyone can help me?


If you mess with the best, u will die like the rest !
#148346 07/05/06 01:50 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
The only one that will help you is yourself, really. If you can't get something as easy to work, it's time to pick up scripting. We will assist you with any problems you occur, but you'll have to do the majority of the work yourself. Read some tutorials, check some other users' socket scripts, and you'll be ready to go.


Gone.
#148347 07/05/06 07:44 AM
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Oct 2005
Posts: 126
Yeah m8, my socket script is working fine... it's just that ".list" and ".mkdir" and ".remove" ... It's not easy to put that in my Socket Script, i did like HixxY said, but, i know it aint right.
-
I've already know the way of doing it right, but, HixxY...
Can you please put this ".list" & ".mkdir" & ".remove) in parts? That those r not together.
-
Like this:

if (*:.list iswm %read) {
do stuff
}
if (*:.mkdir iswm %read) {
do stuff
}
& also with .remove ...
-
That's my only problem, HixxY's code = 1, have to split them in 3...
-
... ? confused

Last edited by PhyxiuS; 07/05/06 08:00 AM.

If you mess with the best, u will die like the rest !
#148348 07/05/06 08:26 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
That's NOT the correct way to do it.

If I type "Hi :.mkdir c:\x" that would create a directory using your method. I already gave you the correct code several posts back.

#148349 07/05/06 01:53 PM
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Oct 2005
Posts: 126
That code aint the right code, and I don't know how to fix that, cuz my Socket Script is like I said above.


If you mess with the best, u will die like the rest !
#148350 07/05/06 01:57 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Have you tried what I gave you before?

#148351 09/05/06 06:06 PM
Joined: Oct 2005
Posts: 126
PhyxiuS Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Oct 2005
Posts: 126
Yes, I did.


If you mess with the best, u will die like the rest !
Page 1 of 2 1 2

Link Copied to Clipboard