thanks, yeah the folders with a lot of files/folders are next to
impossible to read.
I wasn't planning on updating the snippet, but did anyways.
set window on
set display mode 1024,768,32
sync on
sync rate 0
cls
dir$=get dir$()
disable escapekey
maximize window
global file_amount=0
dim file(0) as file_type
type file_type
name$ as string
Byte_size as dword
date as string
date2 as string
angle as float
radius as float
file_type as byte
x as float
y as float
endtype
if file exist(dir$+"data")=1
open to read 1,dir$+"data"
read string 1,s$
set dir s$
close file 1
endif
empty array file(0)
get_files()
global radius#
radius#=300
perform checklist for drives
place$="Parent Folder"
SELECT_num=-1
do
cls rgb(255,255,255)
ink 0,rgb(255,255,255)
if file exist(dir$+"data") then delete file dir$+"data"
open to write 1,dir$+"data"
write string 1,get dir$()
close file 1
dr$=get dir$()
if upper$(place$)=upper$("My computer") then dr$="My Computer"
print "Current directory: ",dr$
inc r#,0.02
for n=0 to array count(file(0))
ink 0,0
k=(n=select_num)
if k=1
ink rgb(0,0,255),0
endif
x#=screen width()/2.0+radius#*cos(file(n).angle+r#)
y#=screen height()/2.0+radius#*sin(file(n).angle+r#)
center text x#,y#-text height("X")*0.5,file(n).name$
file(n).x=x#
file(n).y=y#
file(n).radius=len(file(n).name$)*text width("X")*0.5+3
if file(n).radius>50 then file(n).radius=50
if file(n).radius<30 then file(n).radius=30
circle x#,y#,file(n).radius+k*8
next n
if select_num=-2 then ink rgb(0,0,255),0 else ink 0,0
center text screen width()/2.0,screen height()/2.0-text height("X")*0.5,place$
k=0
if select_num=-2 then k=1
circle screen width()/2.0,screen height()/2.0,100+k*8
mouseover=-1
closest#=1000
for n=0 to file_amount-1
dist#=sqrt((mousex()-file(n).x)^2+(mousey()-file(n).y)^2)
if dist#<=file(n).radius and dist#<closest#
closest#=dist#
mouseover=n
endif
next n
if (select_num>=0)
print "Name: ",file(select_num).name$
if file(select_num).file_type<>2
if file(select_num).file_type=0
print "Size: ",size$(file(select_num).byte_size)
print "Type: ",file_type$(file(select_num).name$)
endif
if file(select_num).file_type=1
print "Folder"
endif
print "Date Modified: ",file(select_num).date
print "Date Created: ",file(select_num).date2
else
print "Drive"
endif
endif
if select_num=-2
print place$
endif
if mouseclick()=1 and mouseover>=0
if select_num<>mouseover
select_num=mouseover
else
select_num=-1
if file(mouseover).file_type>=1
set dir file(mouseover).name$
empty array file(0)
get_files()
place$="Parent Folder"
else
execute file file(mouseover).name$,"",""
endif
endif
while mouseclick()>0:endwhile
endif
dist#=sqrt((mousex()-screen width()/2.0)^2+(mousey()-screen height()/2.0)^2)
if dist#<100
over_parent_folder=1
else
over_parent_folder=0
endif
if mouseclick()=1
if over_parent_folder=1
if select_num<>-2
select_num=-2
else
select_num=-1
if len(get dir$())=3
empty array file(0)
get_drives()
place$="My Computer"
else
set dir ".."
empty array file(0)
get_files()
place$="Parent Folder"
endif
endif
endif
while mouseclick()=1
endwhile
endif
sync
loop
function get_files()
start=1
file_num=0
last_name$=""
name$=""
file_amount=0
repeat
next0:
if start =1
find first
start=0
else
find next
endif
last_name$=name$
name$=get file name$()
if last_name$=name$ then exit
if name$="." or name$=".." then goto next0
array insert at bottom file(0)
num=array count(file(0))
file(num).name$=name$
file(num).byte_size=file size(get file name$())
file(num).file_type=get file type()
file(num).date=get file date$()
file(num).date2=get file creation$()
until 1=2
file_amount=array count(file(0))+1
for n=0 to file_amount-1
file(n).angle=360.0*((n+0.0)/(file_amount+0.0))
next n
endfunction
function get_drives()
length=checklist quantity()
for n=1 to length
array insert at bottom file(0)
num=array count(file(0))
file(num).name$=checklist string$(n)
file(num).file_type=2
`file(num).byte_size=checklist value a(n)
next n
file_amount=array count(file(0))+1
for n=1 to file_amount-1
file(n).angle=360.0*((n+0.0)/(file_amount+0.0))
next n
endfunction
function size$(bytes)
s$=" B"
if bytes>1024
bytes=bytes/1024
s$=" KB"
endif
s$=str$(bytes)+s$
endfunction s$
function file_type$(s$)
n$=""
k=len(s$)
repeat
dec k
until mid$(s$,k)="." or k<=0
t$=right$(s$,len(s$)-k)
if k<=0 then t$="File"
endfunction t$
This update has double clicking, click an unselected file/folder to select it. Click the selected folder a second time to run the file/enter the folder.
When a file is selected you can see:
The Size in kb, if less than 1 kb then in b
The File Type (txt,doc,exe,mp3,dba,zip,rar, etc...), i made a little function to do that.
The Date Modified
The Date Created
For folders you can only see the date modified and created, the size and file type wouldn't make sense for folders.
It also remembers where the directory you were in last time you ran the program. So if you go to a directory, and then close the program. the next time you run the program it will start in that directory. (it will create a data fild in the folder you save the program to. if you delete the data file, it will not remember the directory you were in and will start the program at the directory you run the program and recreate the data file.)
-----------------------------------
To delete the bug, delete the code.
Specs: Sony VAIO Laptop, Windows XP, P4 2.8Ghz, 512MB RAM, ATI Radeon 64MB video memory, DBP Upgrade 5.3.