Ok, here is an example.
This script takes your INI file and displays the servers in descending uptime order.
The output using your example file looks like this:
Server Description IP Address Up Time
------------------ ---------- -------
Server6 193.198.193.6 27
Server3 193.198.193.3 23
Server4 193.198.193.4 17
Server5 193.198.193.5 12
Server2 193.198.193.2 9
Server1 193.198.193.1 4
Code:
Break ON
$=SetOption("Explicit","ON")
Dim $sIni,$asData
Dim $sSection,$sKey,$sDelimiter
Dim $iIndex,$sSpaces30
$sSpaces30=" "
$sIni=".\uptime.ini"
$sDelimiter="|@@=@@|"
$iIndex=0
For Each $sSection in Split(ReadProfileString($sIni,"",""),Chr(10))
If $sSection
Redim Preserve $asData[$iIndex]
$asData[$iIndex]=
Right($sSpaces30+ReadProfileString($sIni,$sSection,"Uptime"),10)
+$sDelimiter
+ReadProfileString($sIni,$sSection,"Desc")
+$sDelimiter
+ReadProfileString($sIni,$sSection,"IP")
$iIndex=$iIndex+1
EndIf
Next
; Array loaded, now sort it.
$asData=QS($asData)
Left("Server Description"+$sSpaces30,20)+Left("IP Address"+$sSpaces30,15)+Right($sSpaces30+"Up Time",10)+@CRLF
Left("------------------"+$sSpaces30,20)+Left("----------"+$sSpaces30,15)+Right($sSpaces30+"-------",10)+@CRLF
; Now display in sorted order.
While $iIndex
$iIndex=$iIndex-1
$sSection=Split($asData[$iIndex],$sDelimiter)
Left($sSection[1]+$sSpaces30,20)
+Left($sSection[2]+$sSpaces30,15)
+Right($sSpaces30+$sSection[0],10)+@CRLF
Loop
Exit 0
; BrianTX's Quicksort
function qs($a)
DIM $b[32],$c[32],$d,$e,$f,$g,$h,$i,$j,$k,$l
$b[0]=0
$c[0]=UBOUND($a)
$d=0
While $d >=0
$e=$b[$d]
$f=$c[$d]
While $e < $f
$h=$e+($f-$e)/2
$k=$a[$e]
$A[$e]=$A[$h]
$A[$h]=$k
$i=$e+1
$j=$f
$l=0
Do
While ($i<$j) AND $A[$e] > $A[$i]
$i=$i+1
Loop
While ($j>=$i) AND $A[$j] > $A[$e]
$j=$j-1
Loop
IF $i>=$j
$l=1
ELSE
$k=$A[$i]
$A[$i]=$A[$j]
$A[$j]=$k
$j=$j-1
$i=$i+1
ENDIF
Until $l=1
$k=$a[$e]
$a[$e]=$a[$j]
$a[$j]=$k
$g=$j
If $g-$e <= $f - $g
If $g+1 < $f
$b[$d]=$g+1
$c[$d]=$f
$d=$d+1
Endif
$f=$g-1
Else
If $g-1 > $e
$b[$d]=$e
$c[$d]=$g-1
$d=$d+1
Endif
$e=$g+1
Endif
Loop
$d=$d-1
Loop
$qs=$a
Endfunction