mIRC Home    About    Download    Register    News    Help

Print Thread
#159457 17/09/06 04:31 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
on* start i want to check for a load of files, if theyre in my script folder.

say for e.g, the folder 'dlls'

should i do

if ($isdir(dlls)) ? or $isdir($Scriptdirdlls) ? or no?

also i want to check if there are certain dlls inside the dlls folder

#159458 17/09/06 04:37 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Code:
if ($isdir($scriptdirdlls)) {  }
if ($isfile($scriptdirdlls\x.dll)) {  }
if ($isfile($scriptdirdlls\y.dll)) {  }
if ($isfile($scriptdirdlls\z.dll)) {  }

#159459 17/09/06 04:40 PM
Joined: Sep 2003
Posts: 261
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2003
Posts: 261
Here's a shot in the dark.

Code:
on 1:start: { chizeck }
alias chizeck {
  var %dllsdir = $finddir($mircdir,dlls,1)
  ;var %dllsdir = $finddir($scriptdir,dlls,1)
  ;if directory dlls is in or under $scriptdir

  var %dllstocheckfor = hi.dll cow.dll mouse.dll milk.dll
  if ($isdir(%dllsdir)) { 
    var %i = 1
    var %howmanydllfilesareinthisdirectory = $findfile(%dllsdir,*.dll,0)
    while (%i <= %howmanydllfilesareinthisdirectory) {
      var %currentdll = $nopath($findfile(%dllsdir,*.dll,%i))
      if (%currentdll isin %dllstocheckfor) { echo -ag %currentdll is in %dllstocheckfor }
      inc %i
    }
  }
}


Slightly revised this since you replyed.

Last edited by Scorpwanna; 17/09/06 04:48 PM.
#159460 17/09/06 04:41 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
thanksss so much guys!!!!!!!!!

and i hope the isfile and isdir are in any mirc version lol

Last edited by pouncer; 17/09/06 04:42 PM.
#159461 17/09/06 05:25 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
versions.txt

v5.5:

114.Added $isfile(filename) and $isdir(dirname) identifiers, return $true
or $false.

I suggest you download the full versions.txt from http://www.mirc.co.uk/versions.txt so you can check yourself.

#159462 17/09/06 05:28 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
That is a very very inefficient and longwinded way of doing this.

Code:
on *:start:{ check }
alias check {
  var %dlls = x.dll y.dll z.dll, %i = 1
  while ($gettok(%dlls,%i,32) != $null) {
    if (!$isfile($+($scriptdir,dlls\,$v1))) { echo $color(info) -a * $gettok(%dlls,%i,32) appears to be missing. }
    inc %i
  } 
}

#159463 17/09/06 07:50 PM
Joined: Sep 2003
Posts: 261
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2003
Posts: 261
I don't know the level of scripting this person has, so I offered a splitting up of information rather than shorten it. But thanks for showing them a shorter version.

#159464 18/09/06 09:41 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Not only shorter, but $findfile() and $finddir() are very CPU intensive identifiers. They're also more complicated to use than $isfile() and $isdir()

#159465 18/09/06 04:37 PM
Joined: Sep 2003
Posts: 261
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2003
Posts: 261
Yeah, I've only used them rarely. Thanks again.


Link Copied to Clipboard