mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2005
Posts: 122
O
Vogon poet
OP Offline
Vogon poet
O
Joined: Oct 2005
Posts: 122
hey i need help with part of a script basically wut i need is when a dcc chat is opened, there will usually be two things in the window. 1) folders (which will be in caps) 2) files (which will be lowercase)

and also in the window their can be FOLDERS and files together, now what im workin on is if the filename isnt *.XYZ it writes it to a text file with

$nick at $time on $date with "filename.YYY"

and this has to be done for every folder so it might be like this when u enter the dcc chat

1. FOLDER 1 (so we go into FOLDER 1)

2. \FOLDER 1
FOLDER2
FOLDER3
filename1.xxx
filename2.zzz
filename3.dff

then it has to check the 3 file names, then say we go into FOLDER 2:

3. \FOLDER 1\FOLDER2
FOLDER4
filename4.dsj
filename5.dhf

so it checks filenames 4 and 5 then goes into folder 4

4. \FOLDER 1\FOLDER2\FOLDER4
filename6.dff
filename7.dhd

Now we have to get back to Folder 1 because rememberer FOLDER 3 was in there too, not just FOLDER2

so we need to do cd .. then cd .. again so we arive at

\FOLDER 1
FOLDER2
FOLDER3
filename1.xxx
filename2.zzz
filename3.dff

now we have to go to folder 3 etc and the process goes on

-----------------------------------------------------

now i know there are 2 ways (of well which i know) which can do this, both are too hard for me. 1) is a tree search alghorithm 2) is with a temporary file

ill explain wut i mean by the temporary file (as i dun even really know wut to do with the tree search alghorithm)

alright so this is whats gonna happen:

when the dcc chat is initialised we create a temporary file then add a \ to it

so the file will look liek this 1stly:

\

then when we do a dir filenames and folders will appear (ill use the example i used above). For Foldernames wee add them to the file

so when we first tot he dir our temporary file will have this

\
FOLDER1

now since initially theres going to be no filenames we in the initial dir we immediately do CD FOLDER1. When this happens we add another \ then again when we get into the folder we write all the foldernames in there and check the files which appear there. But also once we go into the folder the FOLDERNAME gets dlted.

so then we end up with this in folder 1:

FOLDER2
FOLDER3
filename1.xxx
filename2.zzz
filename3.dff

so in our temporary file it will look like this

\
\
FOLDER2
FOLDER3

alright what we want the script to do is ALWAYS read the last line. so since the last line is FOLDER3 we will do a CD FOLDER3

so in our folder3 file we have:

filename.hdf
filename.dje

and our temporary file will look like this

\
\
FOLDER2
\

so now the script reads the last line so since its \ we do a cd ..

so now we are back at FOLDER1 with the contents:

FOLDER2
FOLDER3
filename1.xxx
filename2.zzz
filename3.dff

and in the temporary file:

\
\
FOLDER2

so again the script reads the last line, which is FOLDER2 so we do a CD FOLDER2 . So in folder2 we have:

FOLDER4
filename4.dsj
filename5.dhf

so our script will check the filenames. Our temporary file will look like this

\
\
\
FOLDER4

so since the last line is FOLDER4 we will do a CD FOLDER4, the contents of that folder is:

filename6.dff
filename7.dhd

so it checks those files and we look at the temporary file it will be

\
\
\
\

so then we do cd .. X4

and were back where we started. Tried to explain it the best i could.

Can someone help us out?

Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
Perhaps you should try writing some of this yourself, and then post what you have and see if others will help. Usually, people are generally more inclined to help, once a person puts out code. Rather than saying "hi I'd like a script to do this, this and this. please help me make it!"

Most of the information you need is in the help file.
/help $findfile
/help $finddir
/help on chat

Joined: Oct 2005
Posts: 122
O
Vogon poet
OP Offline
Vogon poet
O
Joined: Oct 2005
Posts: 122
if i could i would, truth is im new to mirc scriptin, thats not to say im not gettin ppl to do everythin for me im makin bout 5 random scripts a day each gettin betta and betta and readin heaps of tuts, but my head is gonna explode today if i read any more info, and i tho the help files will most certainly help - it will still take me a long time to make it - but i need this bit done quickly

Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
Maybe someone with more time on their hands will step up to the plate. Personally, having other people write code specially tailored for you, really isn't going to help you learn. If I had children, I certainly would not do all their math homework for them.

The *easiest* way to learn mIRC scripting is by testing. Want to test how $findfile() works? Use it in mIRC's editbox/command line.

ie:/help $findfile
This retuns how many files are in the directory: //echo -stg $findfile(c:\dirname,*,0,1)
This returns the name of the first file: $findfile(c:\dirname,*,1,1)

The paremeters I used are as follows: dir path, wildcard, # of item, depth to search.

Now go play //echo $findfile()

Joined: Oct 2005
Posts: 122
O
Vogon poet
OP Offline
Vogon poet
O
Joined: Oct 2005
Posts: 122
using ur maths analagoy, an 8 yr old who needs to figure out a college grade question isnt going to be able to do it straight away. He needs to work himself up, and will eventually learn, but in the meantime ur not gonna wait agez for it to be done if u needed it done quickly.

Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
8 year olds don't do college math (I'm sure there are a few exceptions). Though I bet you already knew that.

Why do you need this done quickly? Care to explain? I'll give you a few examples on *how* to do it, but I'm not going to write the entire thing for you.

There are a few different ways you could do this.

However, doing it the way you want it to be done would probably be messy. Do you just need the file names to be listed? If you're not going to give code, in order for others to work with, you should be very specific about what you want.

Anyway. If you want to just "list" all the file names in a directory, you could do something like:

Code:
alias filelist {
  var %dir = $1- , %i = 1
  while ($findfile(%dir,*.*,%i)) {
    echo -stg $v1 | inc %i
  }
}


Edit:
Go ahead and test this by typing /filelist c:\something
Just make sure that the dir has dirs / files in it, this will go through and list every file in all of the dirs within the specified dir.

Last edited by Rand; 22/10/05 10:01 AM.
Joined: Oct 2005
Posts: 122
O
Vogon poet
OP Offline
Vogon poet
O
Joined: Oct 2005
Posts: 122
what i needed was to check if a filename wasnt for example have the extention *.XYZ , i dont really mind how its done, but the prob is, that it cant be a simple thing that checks because there are folder in dcc chats and folders within folders etc, so it needs to be done that the script goes thru every folder that is on the server. didnt think u quite understood what i wanted.

p.s lol i know 8 yr olds wouldnt need 2 do college maths, was jus usin it as an example

Last edited by onesikgypo; 22/10/05 10:12 AM.
Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
Okay wait, are you using this to BROWSE other people's folders?

Joined: Oct 2005
Posts: 122
O
Vogon poet
OP Offline
Vogon poet
O
Joined: Oct 2005
Posts: 122
yes, so basically im just opening up the dcc chat, going thru the folders looking for files that arent meant to be there, if there is a file thats not meant to be there it records it to a txt file, if it doesnt, all it should do is go thru all the folders in the server, then close

Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
I personally don't browse fservers, and haven't for quite a long time.

So, maybe someone else has created something like this.

It probably wouldn't be all that hard to write, but I don't really feel like messing with people's fserves.

Good luck finding someone who will though.

Joined: Oct 2005
Posts: 122
O
Vogon poet
OP Offline
Vogon poet
O
Joined: Oct 2005
Posts: 122
you wouldnt be messing with anyones fserver, just browsing them.....

Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
That's the point, at 6am in the morning (no I haven't slept yet), I don't have much enthusiasm when it comes to browsing a fileserver.

Why are you even needing to do this, btw?

Joined: Oct 2005
Posts: 122
O
Vogon poet
OP Offline
Vogon poet
O
Joined: Oct 2005
Posts: 122
this is part of a big script which is there to allow safety for the users, its to make sure that know server is trying to trick or serve exe's etc to the public which will most probably be viruses, weve had a few attacks before by people trying to do this

Joined: Oct 2005
Posts: 122
O
Vogon poet
OP Offline
Vogon poet
O
Joined: Oct 2005
Posts: 122
Any help :s

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Depending on the fserv script the server uses, the folder names could be in caps already, or surrounded by <>'s or some other method to indicate it's a folder. You'd have to make the script to determine each method of display to figure out if it's a folder or a file. That's probably the most difficult (or at least, time consuming) part as you would need to look at the output of many different fserv scripts to find all the possible ways and to make your script work with those ways and convert them all into the same upper/lowercase format that you want.

Beyond that:
Code:
on *:text:*:=:{
  if (*.exe * iswm $1-) {
    echo -a $nick has an EXE file: $1-
  }
  elseif (*.ini * iswm $1-) {
    echo -a $nick has an INI file: $1-
  }
  [color:green]; Repeat as necessary.[/color]
}


That would echo to the active window... you'd probably want to /echo it somewhere else, or to /write it to a file.

That alone would trigger on any dcc chat (fserv) that has

this is my file.exe 15kB

...or something like that, where there is *.exe and a space and then something else... folders don't have a filesize, but files do, so this would work for most and folder names without worrying about the capitalization of the folders/files. The only way it would trigger on a folder name is if the folder name was something like:

<My .EXE Folder>


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard