|
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.
If you mess with the best, u will die like the rest !
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
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'...
If you mess with the best, u will die like the rest !
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
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?
If you mess with the best, u will die like the rest !
|
|
|
|
Joined: Aug 2005
Posts: 525
Fjord artisan
|
Fjord artisan
Joined: Aug 2005
Posts: 525 |
Why re-invent the wheel?
/help /remove /help /mkdir
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
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,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
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
If you mess with the best, u will die like the rest !
|
|
|
|
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
If you mess with the best, u will die like the rest !
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
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.
If you mess with the best, u will die like the rest !
|
|
|
|
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
If you mess with the best, u will die like the rest !
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
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.
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
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.
If you mess with the best, u will die like the rest !
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
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.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Blah de blah blah. Aren't you supposed to be gone?
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
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. :-)
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Heh, I got lost in the moment. :tongue:
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
You would have to do something like this: 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-
} 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.
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
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.
|
|
|
|
Joined: Oct 2005
Posts: 126
Vogon poet
|
OP
Vogon poet
Joined: Oct 2005
Posts: 126 |
Well, uuhm... Nice conversation But can someone try to solve my problem? :tongue:
If you mess with the best, u will die like the rest !
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
|
|
|
|
Joined: Oct 2005
Posts: 126
Vogon poet
|
OP
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 !
|
|
|
|
Joined: Oct 2005
Posts: 126
Vogon poet
|
OP
Vogon poet
Joined: Oct 2005
Posts: 126 |
HixxY, the code aint working, and i putted it all 100% right. It's something like this:
if (%list == bla || %mkdir == bla || %r3move == bla) { do.writ3 privmsg %channel : $+ $read(%list) & if ($readed == %list) { (show the requested list of files) & if = mkdir (create dir) & 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 !
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
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.
|
|
|
|
Joined: Oct 2005
Posts: 126
Vogon poet
|
OP
Vogon poet
Joined: Oct 2005
Posts: 126 |
If you mess with the best, u will die like the rest !
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
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.
|
|
|
|
Joined: Oct 2005
Posts: 126
Vogon poet
|
OP
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... - ... ?
Last edited by PhyxiuS; 07/05/06 08:00 AM.
If you mess with the best, u will die like the rest !
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
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.
|
|
|
|
Joined: Oct 2005
Posts: 126
Vogon poet
|
OP
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 !
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
Have you tried what I gave you before?
|
|
|
|
Joined: Oct 2005
Posts: 126
Vogon poet
|
OP
Vogon poet
Joined: Oct 2005
Posts: 126 |
If you mess with the best, u will die like the rest !
|
|
|
|
|