Platforms to show: All Mac Windows Linux Cross-Platform

/Util/FileList/FileList
Feedback.

Function:
You find this example project in your Plugins Download as a Realbasic project file within the examples folder: /Util/FileList/FileList
This example is the version from Wed, 16th Jun 2009.
Notes: Last modified: Wed, 16th Jun 2009
Class Window1
Inherits Window
// Controls
ControlInstance
Sub DoubleClick() Handles Event
dim i as integer

i=me.Celltag(me.ListIndex,0)

f.item(i).Launch

Exception
End Sub
Sub Change() Handles Event
dim s as string

if me.ListIndex=-1 then
Title=""
else
s=me.Cell(me.ListIndex,0)
Title=s+" "+str(len(s))+" "+str(lenb(s))
end if
End Sub
End ControlInstance

// Properties
Protected Dim f As FileListMBS
Protected Dim base As double

// Event implementations
Sub Open()
dim i,c as integer
dim s as string
dim d as date
dim t as Double
dim z as TimeZoneMBS

z=new TimeZoneMBS

MakeTestFile // Make a test file to test unicode

f=new FileListMBS(SpecialFolder.Desktop)

c=f.Count
Title=str(c)+" items on the desktop"

c=c-1
for i=0 to c
s=f.Name(i)
List.AddRow s'+" "+str(len(s))+" "+str(lenb(s))

if not f.Directory(i) then
List.Cell(List.LastIndex,1)=format((f.PhysicalDataLength(i)+f.PhysicalResourceLength(i))/1024,"0")+" KB"
end if

if f.Visible(i) then
s="visible"
else
s="invisible"
end if

if f.Directory(i) then
s=s+", directory"
end if

List.Cell(List.LastIndex,2)=s

d=new date
t=f.ModificationDate(i)

if t=0 then
List.Cell(List.LastIndex,3)="?"
else
d.TotalSeconds=t+z.GmtDeltaTotalseconds
List.Cell(List.LastIndex,3)=d.ShortDate+" "+d.ShortTime
end if

d=new date
t=f.CreationDate(i)
if t=0 then
List.Cell(List.LastIndex,4)="?"
else
d.TotalSeconds=t+z.GmtDeltaTotalseconds
List.Cell(List.LastIndex,4)=d.ShortDate+" "+d.ShortTime
end if

d=new date
t=f.LastAccessDate(i)
if t=0 then
List.Cell(List.LastIndex,5)="?"
else
d.TotalSeconds=t+z.GmtDeltaTotalseconds
List.Cell(List.LastIndex,5)=d.ShortDate+" "+d.ShortTime
end if

s=Fix(f.Type(i))+"/"+Fix(f.Creator(i))
if s<>"/" then
List.Cell(List.LastIndex,6)=s
end if

List.Cell(List.LastIndex,7)=hex(f.NodeID(i))

List.Cell(List.LastIndex,8)=str(f.IsHardLinked(i))

List.Celltag(List.LastIndex,0)=i // for double click

next

End Sub

// Methods
Function Fix(s as string) As string
dim i,c as integer
dim z,t as string

// removes non printable characters

c=len(s)
for i=1 to c
z=mid(s,i,1)
if asc(z)<32 then
t=T+" "
else
t=T+z
end if
next
Return t

End Function
Protected Sub MakeTestFile()
dim s as string
dim f as FolderItem
dim t as TextOutputStream


f=SpecialFolder.Desktop.Child(s)
t=f.CreateTextFile
t.Write "Hello"

End Sub
End Class

Class App
Inherits Application
End Class


See also:




Links
MBS Filemaker Plugins - Nachhilfe in Wassenach