#22279 - 2002-05-29 03:51 PM
Re: Hello, help with this search script.
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
The result of SPLIT doesn't do the same thing as your first code An example:
code:
$prevline=LTRIM(RTRIM(" 240 file(s) 3,626,893,373 bytes")) $array=split($prevline," ") $files=""+$array[0] $bytes=""+$array[3] ? "files "+$files ? "bytes "+$bytes
The output will be
code:
files 240 bytes 3,626,893,373
An additional SPLIT function is necessary to remove "," symbols. We suggest to use original code. Also we suggest as work-around for too great integer. New version of our code is:
code:
$path="h:\" $tempfile="c:\00003.tmp" ; $lokaal=GetFileVersion("%WINDIR%\Explorer.exe", "Language") IF ($lokaal = "0413Dutch") $string="bestand(en)" ELSE $string="File(s)" ENDIF ? "language "+$lokaal+" -> search for "+$string+" in directory "+$path ; ;=== Vang de DIR info op, filter alle regels weg behalve de regels met $String (directory output) ; SHELL '%comspec% /c dir "$path" /s /a-d /-c | find "$string" >$tempfile' ; IF (Open(1, $tempfile, 2) = 0) $line=ReadLine(1) $prevline=$line WHILE ($line <> "") AND (@error = 0) IF (InStr($line,"$string") <> 0) $prevline=$line ENDIF $line=ReadLine(1) ? " line "+$line ? " prevline "+$prevline LOOP $=Close(1) ENDIF DEL $tempfile ; ? " input "+$prevline $files=Val(Ltrim(Substr($prevline, 1, InStr($prevline, "f") - 2))) ? " files "+$files $bytes=Ltrim(Substr($prevline,InStr($prevline,")")+1,Len($prevline)-InStr($prevline,")")-(Len($prevline)-InStr($prevline,"b")+2))) ? " bytes "+$bytes WHILE (InStr($bytes,",") <> 0) $bytes=Substr($bytes,1,InStr($bytes,",")-1)+Substr($bytes,InStr($bytes,",")+1,Len($bytes)-InStr($bytes,", ")+1) ? " convert "+$bytes LOOP ; ;=== Converteer het resultaat naar een integer variable. ; ? " bytes (string) "+$bytes ? " bytes (integer) "+Val($bytes) IF (Len($bytes) < 4) $Kbytes="0" ELSE $KBytes=Substr($bytes,1,Len($bytes)-3) ENDIF $homedir_Mbytes=Val($Kbytes)/1024 ? " MBytes "+$homedir_Mbytes
Example of latest version:
code:
language 0409English -> search for File(s) in directory h:\ line 214 file(s) 34,605,720 bytes prevline 19 file(s) 3,591,977,164 bytes line 1 file(s) 27,648 bytes prevline 214 file(s) 34,605,720 bytes line 3 file(s) 281,795 bytes prevline 1 file(s) 27,648 bytes line 3 file(s) 1,046 bytes prevline 3 file(s) 281,795 bytes line 240 file(s) 3,626,893,373 bytes prevline 3 file(s) 1,046 bytes line prevline 240 file(s) 3,626,893,373 bytes input 240 file(s) 3,626,893,373 bytes files 240 bytes 3,626,893,373 convert 3626,893,373 convert 3626893,373 convert 3626893373 bytes (string) 3626893373 bytes (integer) -668073923 MBytes 3541
greetings.
|
|
Top
|
|
|
|
Hello, help with this search script.
|
^REL^
|
2002-05-28 03:53 PM
|
Re: Hello, help with this search script.
|
Sealeopard
|
2002-05-28 03:58 PM
|
Re: Hello, help with this search script.
|
^REL^
|
2002-05-28 04:13 PM
|
Re: Hello, help with this search script.
|
MCA
|
2002-05-28 05:28 PM
|
Re: Hello, help with this search script.
|
Sealeopard
|
2002-05-28 05:33 PM
|
Re: Hello, help with this search script.
|
^REL^
|
2002-05-30 12:01 AM
|
Re: Hello, help with this search script.
|
MCA
|
2002-05-30 12:13 AM
|
Re: Hello, help with this search script.
|
^REL^
|
2002-05-30 12:40 AM
|
Re: Hello, help with this search script.
|
MCA
|
2002-05-29 02:54 PM
|
Re: Hello, help with this search script.
|
MCA
|
2002-05-29 03:08 PM
|
Re: Hello, help with this search script.
|
MCA
|
2002-05-29 03:51 PM
|
Re: Hello, help with this search script.
|
^REL^
|
2002-05-29 06:02 PM
|
Re: Hello, help with this search script.
|
BrianTX
|
2002-05-29 06:22 PM
|
Re: Hello, help with this search script.
|
MCA
|
2002-05-29 06:39 PM
|
Re: Hello, help with this search script.
|
BrianTX
|
2002-05-29 08:29 PM
|
Re: Hello, help with this search script.
|
MCA
|
2002-05-29 08:39 PM
|
Re: Hello, help with this search script.
|
DrillSergeant
|
2002-06-03 11:04 AM
|
Re: Hello, help with this search script.
|
MCA
|
2002-06-05 05:10 PM
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|