Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#13

Re: [VBScript] Objekte in Arrays ablegen

  Alt 10. Feb 2007, 22:51
Sorry PUSH!

Hier deine Lösung. Warst ja eigentlich nahe dran.

Set Files = fo.Files
i = 0
ReDim file_array(Files.Count)
For Each File In Files
file_array(i) = File
i = i + 1
Next

Set File = fo.Files
For Each File In fo.Files
//Set Files = file_array(i)
Filedate = File.DateLastModified
Filesize = File.Size
FileName = File.Name
ts.WriteLine "<tr>"
ts.WriteLine "<td class='date'>" & Filedate & "</td>"
ts.WriteLine "<td class='size'>" & Filesize & "</td>"
ts.WriteLine "<td class='name'>" & FileName & "</td>"
ts.WriteLine "</tr>"
Next

Das ist falsch //Set Files = file_array(i)

Wenn es dir Hauptsächlich um das Array geht dann mach es so.

Code:
i = 0
ReDim file_array(Files.Count)
For Each File In Files
  file_array(i) = File & "," & File.DateLastModified & "," & File.Size & "," & File.Name
  i = i + 1
Next
Du mußt das Array dann nur mit dem Delemiter "," spliten dann hast du was du brauchst.
Code:
For i = 0 To UBound(file_array) - 1
  s = Split(file_array(i), ",", -1, vbTextCompare)
  Filedate = s(1)
  Filesize = s(2)
  FileName = s(3)
  ts.WriteLine "<tr>"
  ts.WriteLine "<td class='date'>" & Filedate & "</td>"
  ts.WriteLine "<td class='size'>" & Filesize & "</td>"
  ts.WriteLine "<td class='name'>[url='" & fo.Path & "/" & FileName & "']" & FileName & "[/url]</td>"
  ts.WriteLine "</tr>"
Next
Das Object selbst kannst du nicht in ein array mit einbinden nur den Wert.

gruss Emil
  Mit Zitat antworten Zitat