perform checklist for display modes 
set display mode 640,480,32
set window on
set window size 700,550
set window layout 1,1,0
set window title "BN2'S File scanner"
`image list:
`1=Back
`2=folder button
`3=Picture button
`4=Text Button
`5=object button
`6=sound button
`7=video button
`8-13=c,a,d,e,f,g
`14-17=quick buttons
`18=Back arrow
`19=up
`20=down
`21-24 highlights (drive,button,icon,small)
`25=mouse
`48=Drive
`49=EXE
`50=text
`78=Window
`1000=Main GUI
exportregistry("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","C")
 
drive$=upper$(left$(get dir$(),1))
sync on
hide mouse
if path exist(drive$+":\WINDOWS\Desktop\")=1
	desktop$=drive$+":\WINDOWS\Desktop\"
	document$=drive$+":\My Documents\"
else
	document$=getreg$(1,"Personal",drive$)
	desktop$=getreg$(1,"Desktop",drive$)
endif
dim hotspots(740,565)
gosub makehotspots
show mouse
 
dim maincolor(4)
dim quickrgb1(4)
dim quickrgb2(4)
dim background(4)
 
color1=1
color2=1
color3=1
color4=1
 
quickrgb1(1)=rgb(243,203,141)
quickrgb2(1)=rgb(234,155,38)
maincolor(1)=rgb(0,127,50)
background(1)=rgb(0,0,0)
 
quickrgb1(2)=rgb(127,5,5)
quickrgb2(2)=rgb(255,5,5)
maincolor(2)=rgb(255,5,5)
background(2)=rgb(0,0,0)
 
quickrgb1(3)=rgb(5,127,5)
quickrgb2(3)=rgb(5,255,5)
maincolor(3)=rgb(5,255,5)
background(3)=rgb(0,0,0)
 
quickrgb1(4)=rgb(5,5,127)
quickrgb2(4)=rgb(5,5,255)
maincolor(4)=rgb(5,5,255)
background(4)=rgb(0,0,0)
 
 
 
gosub generategui
 
gosub makebuttons
sprite 11,0,1000,2
sprite 12,0,1000,3
sprite 13,0,1000,4
sprite 14,0,1000,5
sprite 15,0,1000,6
sprite 16,0,1000,7
sprite 17,0,1000,8
sprite 18,0,1000,49
 
set text font "arial",1
`background
sprite 1000,640,480,1
gosub assemblefiles
dim files(4000)
sprite 1,1000,1000,1000
set current bitmap 0
`gosub options
set text font "arial",1
set current bitmap 0
sync
`wait key
gosub assemblefiles
do
	name$=""
	set text font "arial",1
	if backspacekey()=1 and music exist(1)=1
		if music playing(1)
			stop music 1
		endif
		delete music 1
	endif
 
	if backspacekey()=1 and sound exist(1)=1
		if sound playing(1)
			stop sound 1
		endif
		delete sound 1
	endif
 
 
	gosub makeui
	ink 0,0
	box 100,90,639,479
	if fileoffset<0 then fileoffset=0
	maxoffset#=totalfiles/5
	if maxoffset#>int(maxoffset#)
		maxoffset=int(maxoffset#)+1
	else
		maxoffset=maxoffset#
	endif
	ink rgb(255,255,255),0
	text 0,150,str$(maxoffset)
	if fileoffset>maxoffset*60 then fileoffset=maxoffset*60
 
	paste sprite 1,100,90-fileoffset
	ink rgb(255,255,255),0
	draw to front
	sprite 2,mousex(),mousey(),25
	set sprite 2,1,0
	sprite 100,2000,2000,21
	ink rgb(0,0,255),0
	box 150,71,600,83
	ink rgb(255,255,255),0
 
	sprite 2,mousex(),mousey(),25
	draw to front
	text 150,71,upper$(get dir$())
	paste sprite 1000,0,0
	set text size 24
 
	text 10,10,calcday$()
	text 10,30,get date$()
 
 
	hours=val(left$(get time$(),2))
	if hours>12 : hours=hours-12 : ampm$="PM" : else : ampm$="AM" : endif
	time$=str$(hours)+left$(right$(get time$(),6),3)+" "+ampm$
	text 10,50,time$
 
 
	set text size 12
	gosub button_check
	if upkey()=1 or scancode()=201
		dec fileoffset,2
	endif
	if downkey()=1 or scancode()=209
		inc fileoffset,2
	endif
 
	sync
	cls
loop
 
 
end
 
generategui:
`	ink rgb(255,255,50),0
	ink maincolor(color1),0
`	ink rgb(255,255,255),0
	box 0,0,100,479
	box 0,0,639,70
	box 100,70,150,120
 
	ink rgb(0,0,255),0
	box 628,71,639,479
 
	ink 0,0
	fill(100,70,150,120,150,120,49,background(color4))
	get image 1,0,0,640,480
	cls
return
 
button_check:
col=sprite collision(2,0)
`	scale sprite col,110
	for i=1 to 1000
		if sprite exist(i)
			if col=i
				scale sprite col,110
			else
				scale sprite i,100
			endif
		endif
	next i
	if mouseclick()=1
		hide sprite 100
		select col
			case 3
				if path exist("C:\")
					cd "C:\"
					fileoffset=0
					gosub assemblefiles
				endif
			endcase
			case 4
				if path exist("D:\")
					cd "D:\"
					fileoffset=0
					gosub assemblefiles
				endif
			endcase
			case 5
				if path exist("A:\")
					cd "A:\"
					fileoffset=0
					gosub assemblefiles
				endif
 
			endcase
			case 6
				if path exist("E:\")
					cd "E:\"
					fileoffset=0
					gosub assemblefiles
				endif
			endcase
 
			case 7
				fileoffset=0
				gosub mycomputer
			endcase
			case 8
				cd document$
				fileoffset=0
				gosub assemblefiles
			endcase
			case 9
				fileoffset=0
			endcase
			case 10
				cd desktop$
				fileoffset=0
				gosub assemblefiles
			endcase
 
			case 101: set dir "../" : gosub assemblefiles : fileoffset=0 : endcase
			case 102: dec fileoffset,80 : endcase
			case 103: inc fileoffset,80 : endcase
			case 51: gosub options : endcase
			case default: gosub filehandler : gosub filetypebranch : endcase
		endselect
	wait 300
endif	
	if mouseclick()=2 then gosub rightclick
return
 
makehotspots:
Text 0,0,"Loading"
	create bitmap 2,740,565
	color=11
 
	starty=83
	for y=1 to 5
		startx=125
		color=1+10*y
		for x=1 to 5
			ink rgb(color,5,5),0
			box startx,starty,startx+100,starty+85
			inc color
			inc startx,100
			sync
		next x
		inc starty,85
	next y
	ink rgb(255,255,255),0
	starty=0
	startx=0
	set current bitmap 2
	for boxy=0 to 4
		starty=boxy*86
		for boxx=0 to 4
			startx=boxx*100
			color=rgbr(point(startx+125,starty+83))
			for y=0 to 80
				for x=0 to 100
					hotspots(x+startx+125,y+starty+83)=color
				next x
			next y
		next boxx
	next boxy
 
	set current bitmap 0
return
 
assemblefiles:
	ink rgb(255,255,255),0
	set current bitmap 1
	cls
 
	startx=25
	starty=0
	x=startx
	y=starty
	count=0
	type=0
	imgnum=0
	filename$=""
 
	empty checklist
	perform checklist for files	
	totalfiles=checklist quantity()
	find first
 
	for i=1 to totalfiles
		if get file name$()<>"." and get file name$()<>".." and right$(get file name$(),4)<>"-%^&"
			filename$=get file name$()
			type=typehandler(filename$)
			select type
				case 1 : imgnum=2 : sprite=11 : endcase
				case 2 : imgnum=3 : sprite=12 : endcase
				case 3 : imgnum=4 : sprite=13 : endcase
				case 4 : imgnum=5 : sprite=14 : endcase
				case 5 : imgnum=6 : sprite=15 : endcase
				case 6 : imgnum=7 : sprite=16 : endcase
				case 7 : imgnum=5 : sprite=14 : endcase
				case 8 : imgnum=49 : sprite=18 : endcase
				case default : imgnum=49 : sprite=18 : endcase
			endselect			
			paste sprite sprite,x,y
			set text size 12
			maxw=100
			if text width(filename$)>maxw
				x#=text width(filename$)
				t1=0
				t2=0
				val=0
				let$=""
				wordflag=0
				repeat
					repeat
						inc val
						let$=mid$(filename$,val)
					until let$=" " or let$=""
					if let$=""
						wordflag=1
					endif
					f3$=left$(filename$,val)
					f4$=right$(filename$,len(filename$)-val)
					ot1=t1
					ot2=t2
					t1=text width(f3$)
					t2=text width(f4$)
						if abs(t2-t1)<=abs(ot2-ot1)
						wordflag=1
					endif
				until wordflag=1
				f1$=left$(filename$,val)
				f2$=right$(filename$,len(filename$)-val)
 
				if text width(f2$)>maxw
					letcount=0
					repeat
						inc letcount
					until text width(left$(f2$,letcount))>=maxw
					f2$=left$(f2$,letcount-3)+"..."
				endif
				center text x+sprite width(sprite)/2,y+61,f1$
				center text x+sprite width(sprite)/2,y+73,f2$
			else
				center text x+sprite width(sprite)/2,y+65,filename$
			endif
 
			inc x,100
			inc count
			if count=5
				count=0
				inc y,85
				x=startx
			endif			
		endif
`		if get file type()<>-1
			find next
	`	endif
 
	next i
	get image 1000,0,0,550,4000
	set current bitmap 0
	filename$=""
	imgnum=0
	sprite=0
	type=0
return
 
filehandler:
	if hotspots(mousex(),mousey())<>0
		offsety_hs=fileoffset-(int(fileoffset/85))*85
		hotspot#=hotspots(mousex(),mousey()+offsety_hs)
		y#=int((hotspot#/10))-1
		x=hotspot#-10*(y#+1)
		x=x+5*y#+5*(fileoffset/85)
		perform checklist for files
		if (x-1)<=checklist quantity()
			find first
			if get file name$()="."
				find next
				find next
			endif
			if x>1
				for i=1 to x-1
					if get file type()<>-1
						find next
					endif
				next i
			endif
			name$=get file name$()
		endif
	endif
return
 
filetypebranch:
			type=typehandler(get file name$())
			select type
				case 1 : gosub pictures : endcase
				case 2 : gosub handletext : endcase
				case 3 : gosub object : endcase
				case 4 : gosub sound : endcase
				case 5 : gosub video : endcase
				case 6 : if path exist(name$)=1 then cd name$ : gosub assemblefiles : endcase
				case 7 : gosub music : endcase
				case 8 : gosub exe : endcase
			endselect			
			fileoffset=0
			name$=""
return
 
pictures:
	if file exist(name$)
		load image name$,567
		sprite 567,0,0,567
 
		set sprite 567,1,0
		max#=320.0
		repeat
			if upkey()=1 : if 240>=cy: inc cy : endif : endif
			if downkey()=1 : if cy>=-240 : dec cy : endif : endif
 
			if leftkey()=1 and 320>=cx then inc cx
			if rightkey()=1 and cx>=-320 then dec cx
 
			if inkey$()="+" then inc max#,10.0
			if inkey$()="-" then dec max#,10.0
			if max#<=0.0 then max#=10.0
			ink rgb(255,255,255),0
			width#=sprite width(567)
			scale#=max#/width#
			scale sprite 567,scale#*100
			sprite 567,320-(sprite width(567)/2)+cx,240-(sprite height(567)/2)+cy,567
			sync
			scale sprite 567,100
		until returnkey()=1
		delete sprite 567
		delete image 567
	endif
return
 
object:
	if file exist(name$)
		backdrop on
		load object name$,1
		if total object frames(1)>1
			play object 1
			loop object 1
		endif
		repeat
			turn object right 1,1
			sync	
		until scancode()<>0
		delete object 1
		backdrop off
	endif
return
 
video:
	if file exist(name$)
		load animation name$,1
		makewindow(animation width(1)+10,animation height(1)+10,320,240,quickrgb1(color2),quickrgb2(color3))
		play animation 1,320-(animation width(1)/2),240-(animation height(1)/2)
		loop animation 1
		repeat
			sync
		until scancode()<>0
		delete animation 1
	endif
	delete sprite 54
return
 
sound:
	if file exist(name$)
		if sound exist(1)
			if sound playing(1)
				stop sound 1
			endif
			delete sound 1
		endif
		load sound name$,1
		play sound 1
		loop sound 1
	endif
return
 
music:
	if file exist(name$)
		if music exist(1)
			if music playing(1)
				stop music 1
			endif
			delete music 1
		endif
		load music name$,1
		play music 1
		loop music 1
	endif
return
 
exe:
	if file exist(name$)
		execute file name$,"",""
	endif
return
`---------------------------------------------------
handletext:
if file exist(name$)
	open to read 1,name$
	text 0,150,"Loading Text"
	sync
	create bitmap 3,1000,50000
 
set text font "Arial",1
set text size 14
lines=0
	repeat
		repeat
			`80
			read byte 1,letter
			if letter<>10 and flag=1 then flag=0
			line$=line$+chr$(letter)
			inc count
			total=total+1
			if letter=13
				flag=1
			endif
			if total>=file size(name$) then exit
		until count=79 or (flag=1 and letter=10)
 
		count=0
		flag=0
		x=file size(name$)
		text 0,lines*text height("|"),line$
		line$=""
		inc lines
		set current bitmap 0
		string$=str$((total/x)*100)+"% Done"
		text 0,100,string$
		sync
		ink maincolor(color1),0
		box 0,100,100,125
		ink rgb(255,255,255),0
		set current bitmap 3
	until (total>=x)
 
`----------------------------------------------------------------------------------------------
	get image 50,0,0,1000,lines*text height("|")
delete bitmap 3
	sprite 50,0,4000,50
	repeat
		set current bitmap 0
		ink 0,0
		box 125,80,639,479
		ink rgb(255,255,255),0
		paste sprite 50,125-offsetx,83-offsety
		gosub makeui
		if upkey()=1 then dec offsety,10
		if downkey()=1 then inc offsety,10
		if scancode()=201 then dec offsety,100 : wait 5
		if scancode()=209 then inc offsety,100 : wait 5
`		if rightkey()=1 then inc offsetx,5
`		if leftkey()=1 then dec offsetx,5
		maxoffset_txt=(text height("|")*lines)-300
		if offsety>maxoffset_txt then offsety=maxoffset_txt
		if offsetx<0 then offsetx=0
		if offsety<0 then offsety=0
 
		center text 320,55,name$
		sync
		cls
	until returnkey()=1	
	offsety=0
	close file 1
	cls
endif
total=0
delete sprite 50
delete image 50
return
 
makeui:
	`c:
	sprite 3,150,5,8
	`d:
	sprite 4,250,5,9
	`a:
	sprite 5,350,5,10
	`e:
	sprite 6,450,5,11
	i=100
	`My Comp
	sprite 7,1,110+i,14
	`MY DOCUMENTS
	sprite 8,1,140+i,15
	`CONTROL PANEL
	sprite 9,1,170+i,16
	`DESKTOP
	sprite 10,1,200+i,17
	`back arrow
	sprite 101,600,71,18
	`up arrow
	sprite 102,628,71,19
	`down arrow
	sprite 103,628,468,20
	`options
	sprite 51,560,50,51
	paste sprite 1000,0,0
return
 
mycomputer:
	dim drive$(5,5)
	x=50
	y=0
	x2=1
	y2=1
	count=0
	ink 0,0
	set current bitmap 1
	cls
	ink rgb(255,255,255),0
	sprite 105,640,480,48
	if count=5
		y=y+80
		count=0
		x=50
		x2=0
		inc y2
	endif
	paste sprite 105,x,y
	inc count
	center text x+sprite width(105)/2,y+sprite height(105),"A:"
	inc x,100
	drive$(x2,y2)=chr$(i)+":\"
	inc x2
 
	for i=98 to 123
		if path exist(chr$(i)+":\")
			sprite 8+i,640,480,48
			if count=5
				y=y+80
				count=0
				x=50
				x2=0
				inc y2
			endif
			paste sprite 8+i,x,y
			inc count
			center text x+sprite width(8+i)/2,y+sprite height(8+i),upper$(chr$(i))+":"
			inc x,100
			drive$(x2,y2)=chr$(i)+":\"
			inc x2
		endif
	next i
get image 1000,0,0,550,4000
set current bitmap 0
gosub mycomploop
return
 
mycomploop:
sprite 1,1000,0,1000
set current bitmap 0
	repeat
		ink 0,0
		box 100,83,639,479
		ink rgb(255,255,255),0
		paste sprite 1,125,83		
		gosub makeui
		if mouseclick()=1
			if hotspots(mousex(),mousey())<>0
				hotspot=hotspots(mousex(),mousey())
				cy=(hotspot/10)
				cx=hotspot-10*(cy)
				if path exist(drive$(cx,cy))
					cd drive$(cx,cy)
					exitflag=1
				endif
			endif
		endif
		sync
	until exitflag=1
	exitflag=0
	cls
	gosub assemblefiles
return
 
options:
	makewindow(166,166,320,240,quickrgb1(color2),quickrgb2(color3))
	ink rgb(5,5,5),0
	text 245,163,"Primary Color"
	text 245,203,"Button Color 1"
	text 245,243,"Button Color 2"
	text 245,283,"Background Color"
	ink rgb(5,5,5),0
for x=0 to 3
	ink 0,0
	box 265+30*x,178,285+30*x,198
	box 265+30*x,218,285+30*x,238
	box 265+30*x,258,285+30*x,278
	box 265+30*x,298,285+30*x,318
 
	ink maincolor(x+1),0
	box 267+30*x,180,283+30*x,196
	ink quickrgb1(x+1),0
	box 267+30*x,220,283+30*x,236
	ink quickrgb2(x+1),0
	box 267+30*x,260,283+30*x,276
	ink background(x+1),0
	box 267+30*x,300,283+30*x,316
next x
if bitmap exist(3)<>1 then create bitmap 3,640,480
set current bitmap 3
cls
 
set text font "Arial",1
set text size 24
ink rgb(5,5,5),0
center text 320,240,"X"
get image 82,310,230,340,260
delete bitmap 3
 
sync
gosub optionsloop
return
 
optionsloop:
set current bitmap 0
	repeat
		if mouseclick()=1
			repeat
				sync
			until mouseclick()=0
			color=point(mousex(),mousey())
`Changes the main color
			if 198>=mousey() and mousey()>=178
				select color
					case maincolor(1) : color1=1 : endcase
					case maincolor(2) : color1=2 : endcase
					case maincolor(3) : color1=3 : endcase
					case maincolor(4) : color1=4 : endcase
				endselect
			endif
`Changes Quickrgb1
			if 236>=mousey() and mousey()>=220
				select color
					case quickrgb1(1) : color2=1 : endcase
					case quickrgb1(2) : color2=2 : endcase
					case quickrgb1(3) : color2=3 : endcase
					case quickrgb1(4) : color2=4 : endcase
				endselect
			endif
`Changes Quickrgb2
			if 276>=mousey() and mousey()>=260
				select color
					case quickrgb2(1) : color3=1 : endcase
					case quickrgb2(2) : color3=2 : endcase
					case quickrgb2(3) : color3=3 : endcase
					case quickrgb2(4) : color3=4 : endcase
				endselect
			endif		
 
		endif
	ink rgb(255,255,255),0
	text 600,500,str$(color)
	sprite 82,235+30*color1,167,82
	sprite 83,235+30*color2,207,82
	sprite 84,235+30*color3,247,82
 
 
	sync
	until returnkey()=1
	cls
	delete sprite 54
	delete sprite 82
	delete sprite 83
	delete sprite 84
 
	gosub generategui
	gosub makebuttons
return
 
rightclick:
	rx=mousex()
	ry=mousey()
	create bitmap 8,50,150
	set text font "Arial",1
	set text size 12
	ink quickrgb2(color3),quickrgb1(color2)
	cls
	box 3,3,47,197
	gosub filehandler
	if name$<>""
		rgb1=rgb(11,11,11)
	else
		rgb1=rgb(100,100,100)
`		ink rgb(127,127,127),0
	endif
	ink 0,0
	center text 25,5,"Cut"
	line 5,20,45,20
	center text 25,25,"Copy"
	line 5,40,45,40
	center text 25,45,"Paste"
	line 5,60,45,60
	center text 25,65,"Rename"
	line 5,80,45,80
	center text 25,85,"Delete"
	line 5,100,45,100
	center text 25,105,"New"
 
	get image 512,0,0,50,125
	set current bitmap 0
	sprite 512,0,1000,512
	set sprite 512,1,0
	if mousey()>=330
		ry=ry-125
	endif
	if mousex()>=430
		rx=rx-50
	endif
	paste sprite 512,rx,ry
	do
`Cut
		if mousex()>(rx+3) and mousex()<(rx+50) and mousey()>(ry+5) and mousey()<(ry+20)
			color=invertcolor(quickrgb2(color3))
			ink color,0
			box rx+3,ry+3,rx+47,ry+19
			ink invertcolor(rgb1),0
			center text rx+25,ry+5,"Cut"
			if mouseclick()=1
				command$="cut"
				exit
			endif
		else
			color=quickrgb2(color3)
			ink color,0
			box rx+3,ry+3,rx+47,ry+19
			ink rgb1,0
			center text rx+25,ry+5,"Cut"
		endif
`Copy
		if mousex()>rx+3 and mousex()<rx+50 and mousey()>ry+21 and mousey()<(ry+40)
			color=invertcolor(quickrgb2(color3))
			ink color,0
			box rx+3,ry+21,rx+47,ry+39
			ink invertcolor(rgb1),0
			center text rx+25,ry+25,"Copy"
			if mouseclick()=1
				command$="copy"
				exit
			endif
			mouseover=1
		else
			color=quickrgb2(color3)
			ink color,0
			box rx+3,ry+21,rx+47,ry+39
			ink rgb1,0
			center text rx+25,ry+25,"Copy"
		endif
`Paste
		if mousex()>rx+3 and mousex()<rx+50 and mousey()>ry+41 and mousey()<ry+60
			color=invertcolor(quickrgb2(color3))
			ink color,0
			box rx+3,ry+41,rx+47,ry+59
			ink invertcolor(rgb1),0
			center text rx+25,ry+45,"Paste"
			if mouseclick()=1
				command$="paste"
				exit
			endif
			mouseover=1
		else
			color=quickrgb2(color3)
			ink color,0
			box rx+3,ry+41,rx+47,ry+59
			ink rgb1,0
			center text rx+25,ry+45,"Paste"
		endif
`Rename
		if mousex()>rx+3 and mousex()<rx+50 and mousey()>ry+61 and mousey()<ry+80
			color=invertcolor(quickrgb2(color3))
			ink color,0
			box rx+3,ry+61,rx+47,ry+79
			ink invertcolor(rgb1),0
			center text rx+25,ry+65,"Rename"
			if mouseclick()=1
				command$="rename"
				exit
			endif
			mouseover=1
		else
			color=quickrgb2(color3)
			ink color,0
			box rx+3,ry+61,rx+47,ry+79
			ink rgb1,0
			center text rx+25,ry+65,"Rename"
		endif
`Delete
		if mousex()>rx+3 and mousex()<rx+50 and mousey()>ry+81 and mousey()<ry+100
			color=invertcolor(quickrgb2(color3))
			ink color,0
			box rx+3,ry+81,rx+47,ry+99
			ink invertcolor(rgb1),0
			center text rx+25,ry+85,"Delete"
			if mouseclick()=1 
				command$="delete"
				exit
			endif
			mouseover=1
		else
			color=quickrgb2(color3)
			ink color,0
			box rx+3,ry+81,rx+47,ry+99
			ink rgb1,0
			center text rx+25,ry+85,"Delete"
		endif
`New
		if mousex()>rx+3 and mousex()<rx+50 and mousey()>ry+101 and mousey()<ry+120
			color=invertcolor(quickrgb2(color3))
			ink color,0
			box rx+3,ry+101,rx+47,ry+119
			ink invertcolor(rgb1),0
			center text rx+25,ry+105,"New"
			if mouseclick()=1 
				command$="new"
				exit
			endif
			mouseover=1
		else
			color=quickrgb2(color3)
			ink color,0
			box rx+3,ry+101,rx+47,ry+119
			ink rgb1,0
			center text rx+25,ry+105,"New"
		endif
 
		if mouseclick()=1 then exit
	sync
	loop
	wait 250
	select command$
		case "cut" : gosub cut : endcase
		case "copy" : gosub copy : endcase
		case "paste" : gosub paste : endcase
		case "rename" : gosub rename : endcase
		case "delete" : gosub delete : endcase
		case "new" : gosub new : endcase
	endselect
	command$=""
	cls
return
 
cut:
	cc_name$=name$
	cc_loc$=get dir$()
	cc_delete=1
return
 
copy:
	cc_name$=name$
	cc_loc$=get dir$()
	cc_delete=0
return
 
paste:
	cc_newname$=cc_name$
	count=1
	label:
		if path exist(cc_newname$)=1
			cc_newname$="Copy "+str$(count)+" of "+cc_name$
			inc count
			goto label
		endif
	`end of label stuff
	if file exist(cc_loc$+"\"+cc_name$)
		copy file cc_loc$+"\"+cc_name$,cc_newname$
	endif
	if cc_delete=1
		delete file cc_loc$+"\"+cc_name$
	endif
	gosub assemblefiles
return
 
rename:
if path exist(name$)
	renamelabel:
	makewindow(300,35,320,240,quickrgb1(color2),quickrgb2(color3))
	set text size 12
	ink invertcolor(quickrgb1(color2)),0
	text 173,225,"Rename: " +name$+ " to:"
	set cursor 173,242
	sync
	input newname$
	sync
	if file exist(newname$) and newname$<>name$ then goto renamelabel
	if newname$="" then newname$=name$
	if right$(newname$,2)<>right$(name$,2)
		message$="File type not the same! Rename anyway?(Y/N)"
		makewindow(300,35,320,240,quickrgb1(color2),quickrgb2(color3))
		ink invertcolor(quickrgb1(color2)),0
		text 173,225,message$
		set cursor 173,242
		input confirm$
		if upper$(confirm$)="N" or upper$(confirm$)="NO" then newname$=newname$+right$(name$,4)
	endif
	if newname$<>name$
		rename file name$,newname$
	endif
	gosub assemblefiles
endif
return
 
delete:
if path exist(name$)
	message$="Are you sure you want to delete "+name$+"?(Y/N)"
	makewindow(text width(message$)+7,50,320,240,quickrgb1(color2),quickrgb2(color3))
	ink invertcolor(quickrgb1(color2)),0
	center text 320,220,message$
	set cursor 320,240
	input confirm$
	if upper$(confirm$)="Y" or upper$(confirm$)="YES" 
		if file exist(name$)=1
			delete file name$
		else
			if path exist(name$)=1
				rename file name$,name$+"-%^&"
 
				delete directory name$+"-%^&"
			endif
		endif
	endif
	gosub assemblefiles
endif	
return
 
new:
	new_label:
	message$="What would you like to call the file?"
	makewindow(text width(message$)+7,50,320,240,quickrgb1(color2),quickrgb2(color3))
	ink invertcolor(quickrgb1(color2)),0
	center text 320,220,message$
	set cursor 320,240
	input newname$
	if path exist(newname$)<>1
		make directory newname$
	else
		goto new_label
	endif
	gosub assemblefiles
return
 
 
makebuttons:
set text font "Arial",1
set text size 12
	`FOLDER BUTTON
	ink rgb(227,217,91),0
	box 320,240,380,285
	box 320,225,350,285
	fill(320,225,380,285,350,240,16,rgb(227,217,91))
	get image 7,320,225,380,285
	cls
 
	`PICTURE BUTTON
	ink rgb(127,127,127),0
	box 320,240,380,300
	ink rgb(227,217,91),0
	box 325,245,375,295
	set text size 45
	ink rgb(5,5,5),0
	text 337,247,"P"
	get image 2,320,240,380,300
	cls
 
	`TEXT BUTTON
	ink rgb(127,127,127),0
	box 320,240,380,300
	ink rgb(230,230,255),0
	box 330,245,370,295
	ink rgb(5,5,5),0
	line 335,255,365,255
	line 335,270,365,270
	line 335,285,365,285
	get image 3,320,240,380,300
	cls
 
	`OBJECT BUTTON
	ink rgb(127,127,127),0
	box 320,240,380,300
	ink rgb(227,217,91),0
	box 325,245,375,295
	set text size 45
	ink rgb(5,5,5),0
	text 337,247,"O"
	get image 4,320,240,380,300
	cls
 
	`SOUND BUTTON
	ink rgb(127,127,127),0
	box 320,240,380,300
	ink rgb(5,5,5),0
	box 325,245,375,295
	ink rgb(230,230,255),0
	x=325
	x2=325
	y2#=270
	for i=1 to 50
		y#=sin(20*i)*20+270
		line x,y#,x2,y2#
		x2=x
		y2#=y#
		inc x,1
	next x
	get image 5,320,240,380,300
	cls
 
	`VIDEO BUTTON
	ink rgb(127,127,127),0
	box 320,240,380,300
	ink rgb(227,217,91),0
	box 325,245,375,295
	set text size 45
	ink rgb(5,5,5),0
	text 337,247,"V"
	get image 6,320,240,380,300
	cls
 
	`DRIVE BUTTONS
	ink quickrgb1(color2),0
	box 100,100,400,166
	ink quickrgb2(color3),0
 
	box 105,105,195,128
	box 205,105,295,128
	box 305,105,395,128
 
	box 105,138,195,161
	box 205,138,295,161
	box 305,138,395,161
 
	ink rgb(5,5,5),0
	set text size 24
	center text 150,108,"C:"
	center text 250,108,"D:"
	center text 350,108,"A:"
 
	center text 150,141,"E:"
	center text 250,141,"F:"
	center text 350,141,"G:"
 
	get image 8,100,100,200,133
	get image 9,200,100,300,133
	get image 10,300,100,400,133
 
	get image 11,100,133,200,166
	get image 12,200,133,300,166
	get image 13,300,133,400,166
	cls
 
	`QUICK BUTTONS
	ink quickrgb1(color2),0
	box 100,40,200,160
	ink quickrgb2(color3),0
	box 100,42,200,68
	box 100,72,200,98
	box 100,102,200,128
	box 100,132,200,158
 
	set text size 16
	ink rgb(5,5,5),0
	center text 150,45,"My Computer"
	center text 150,75,"My Documents"
	center text 150,105,"Control Panel"
	center text 150,135,"Desktop"
 
	get image 14,100,40,200,70
	get image 15,100,70,200,100
	get image 16,100,100,200,130
	get image 17,100,130,200,160
	cls
 
	`OPTIONS BUTTON
	set text font "Arial",1
	set text size 12
	ink quickrgb1(color2),0
	box 0,0,51,15
	ink quickrgb2(color3),0
	box 2,2,48,12
	ink rgb(5,5,5),0
	center text 25,2,"Options"
	get image 51,0,0,51,15
`----------------------------------------------------------------------------------------------
 
	`<- BUTTON
set text font "arial",2
	ink rgb(100,100,100),0
	box 320,240,332,252
	ink rgb(127,127,127),0
	box 322,242,330,250
	set text size 12
	set text to bold
	ink rgb(0,127,0),0
	Center Text 326,241,chr$(215)
	get image 18,320,240,332,252
	cls
 
 
	`/\ Button
	ink rgb(100,100,100),0
	box 320,240,332,252
	ink rgb(127,127,127),0
	box 322,242,330,250
	set text size 12
	`set text to bold
	ink rgb(5,5,5),0
	Center Text 327,241,chr$(217)
	get image 19,320,240,332,252
	cls
 
	`\/ BUTTON	
	ink rgb(100,100,100),0
	box 320,240,332,252
	ink rgb(127,127,127),0
	box 322,242,330,250
	set text size 12
	set text font "Arial",2
	ink rgb(5,5,5),0
	Center Text 327,241,chr$(218)
	get image 20,320,240,332,252
	cls
 
	`EXE BUTTON
	set text font "Arial",2
	ink rgb(127,127,127),0
	box 320,240,380,300
	ink rgb(5,5,255),0
	box 325,245,375,295
	set text size 45
	ink rgb(5,255,5),0
	text 337,247,chr$(216)
	get image 49,320,240,380,300
	cls
`-------------------------------------------------------------------------------------------------------------------
	`DRIVE ICON
	ink rgb(127,127,127),0
	box 320,240,380,300
	ink rgb(255,255,255),0
	box 325,245,375,295
	set text font "Arial",2
	set text size 72
	ink 0,0
	text 322,225,chr$(59)
	get image 48,320,240,380,320
	cls
`---------------------------------------------------------------------------------------------------------
	`Button Highlights
	create bitmap 1,640,4000	
	ink 0,rgb(255,255,255)
	cls
	ink 0,0
	level#=250
	count#=480*640*(level#/100)
	for i=1 to count#
		dot rnd(640),rnd(480)
	next i
`quick drive highlights	
	get image 21,0,0,100,33
`quick button highlights
	get image 22,320,240,420,270
`icon highlights
	get image 23,40,60,100,120
`small highlights
	get image 24,10,38,22,50
	cls
set current bitmap 0
 
	`MOUSE COLLISION BOX
	ink 0,rgb(11,11,11)
	cls
	get image 25,320,240,322,242
	ink rgb(255,255,255),0
	set text size 12
return
 
function distance#(x,y,cx,cy)
	r#=sqrt(abs(((cx-x)*(cx-x)+(cy-y)*(cy-y))))
endfunction r#
 
 
 
function fill(startx,starty,endx,endy,cx,cy,r,color)
ink color,0
for y=starty to endy
	for x=startx to endx
		if distance#(x,y,cx,cy)<=r
			dot x,y
		endif
	next x
next y
endfunction
 
`CREATED BY: MadrMan March 5,2006
`Revised BY: BN2 Productions July 23,2008
function exportregistry(path$,drive$)
c=0
a=0
d=0
aa=0
string$=""
stringb$=""
param$=""
if file exist(drive$+":\reg.reg")=0
	location$=drive$+":\reg.reg"
	reg$="/e " + location$ + " " + chr$(34)+path$+chr$(34)
	execute file "regedit.exe",reg$,""
endif
endfunction
 
 
function getreg$(file,key$,drive$)
	exitflag=0
	lines=0
	open to read file,drive$+":\reg.reg"
	key$=chr$(34)+key$+chr$(34)
repeat
	count=0
	temp$=""
	repeat
		read byte file,temp
		temp$=temp$+chr$(temp)
		if temp=13 then flag=1
		inc count
	until temp=10 and flag=1
	inc lines
	if left$(temp$,len(key$))=key$ then exitflag=1
until exitflag=1 or count=file size("C:\reg.reg")
 
	path$=right$(temp$,len(temp$)-len(key$)-1)
	count=len(path$)
	path$=right$(path$,count-1)
	count=len(path$)
	path$=left$(path$,count-3)
close file file
endfunction path$
 
 
 
 
 
 
function typehandler(file$)
	remstart
	pics
		bmp
		png
		jpg
	text
		txt
		doc
	object
		3ds
		x
	sound
		xm
		wma
		wav
		mp3
	video
		avi
		wmv
		mpg
		mpeg
	remend
	dim extension$(20)
`1
	extension$(1)=".bmp"
	extension$(2)=".png"
	extension$(3)=".jpg"
`2
	extension$(0)=".dba"
	extension$(4)=".txt"
	extension$(5)=".doc"
	extension$(19)=".ini"
`3
	extension$(6)=".3ds"
	extension$(7)=".x"
`4
	extension$(8)=".xm"
	extension$(9)=".wma"
	extension$(10)=".wav"
	extension$(11)=".mp3"
`5
	extension$(12)=".avi"
	extension$(13)=".wmv"
	extension$(14)=".mpg"
	extension$(15)="mpeg"
 
`7
	extension$(16)=".mid"
`8
	extension$(17)=".exe"
`9
	extension$(18)=".lnk"
 
	ext$=right$(file$,4)
	select lower$(ext$)
		case extension$(0) : type=2 : endcase
		case extension$(1) : type=1 : endcase
		case extension$(2) : type=1 : endcase
		case extension$(3) : type=1 : endcase
		case extension$(4) : type=2 : endcase
		case extension$(5) : type=8 : endcase
		case extension$(6) : type=3 : endcase
		case extension$(9) : type=4 : endcase
		case extension$(10) : type=4 : endcase
		case extension$(11) : type=4 : endcase
		case extension$(12) : type=5 : endcase
		case extension$(13) : type=5 : endcase
		case extension$(14) : type=5 : endcase
		case extension$(15) : type=5 : endcase
		case extension$(16) :  type=7 : endcase
		case extension$(17) : type=8 : endcase
		case extension$(18) : type=8 : endcase
		case extension$(19) : type=2 : endcase
		case default : type=0 : endcase
	endselect
 
	if lower$(right$(ext$,2))=extension$(7) then type=3
	if lower$(right$(ext$,3))=extension$(8) then type=7
	if type=0
		find first
		while get file name$()<>file$ and get file type()>-1
			find next
		endwhile
		if get file type()<>-1
			if get file type()=1
				type=6
			endif
		endif
 
	endif
	if type=0 then type=8
 
endfunction type
 
function makewindow(width,height,x,y,color1,color2)
	create bitmap 31,width+1,height+1
	ink color1,color2
	cls
	box 3,3,width-3,height-3
	get image 54,0,0,width,height
	set current bitmap 0
	sprite 54,1000,0,54
	paste sprite 54,x-(width/2),y-(height/2)
	delete bitmap 31
endfunction
 
function backspacekey()
endfunction keystate(14)
 
 
function wrap(number,start,end)
	repeat
		if number>end then dec number,end
		if number<start then inc number,end
	until number<=end and number>=start
endfunction number
 
function calcday$()
	dday=3
	day=val(left$(right$(get date$(),5),2))
	month=val(left$(get date$(),2))
	year=val(right$(get date$(),2))
	dim monthdata(12,2)
	if int(year/4)=year/4
		monthdata(1)=4
		monthdata(2)=1
	else
		monthdata(1)=3
		monthdata(2)=0
	endif
		monthdata(3)=0
		monthdata(4)=4
		monthdata(5)=9
		monthdata(6)=6
		monthdata(7)=11
		monthdata(8)=8
		monthdata(9)=5
		monthdata(10)=10
		monthdata(11)=7
		monthdata(12)=12
		year#=year
		q#=int(year#/12)
		r=((year#/12)-q)*12
		r#=r
		s=r#/4
		t=q+r+s
		`Figures out what day of the week dday is
		dday=wrap(dday+t,1,7)
		day=day-monthdata(month)
		day#=day
		x#=int(day#/7)
		diff1#=day#-x#*7
		diff1=diff1#
		wkday=wrap(diff1+dday,1,7)
		select wkday
			case 1: wkday$="Sunday" : endcase
			case 2: wkday$="Monday" : endcase
			case 3: wkday$="Tuesday" : endcase
			case 4: wkday$="Wednesday" : endcase
			case 5: wkday$="Thursday" : endcase
			case 6: wkday$="Friday" : endcase
			case 7: wkday$="Saturday" : endcase
		endselect
		undim monthdata(12)
endfunction wkday$
 
function invertcolor(color)
	r=rgbr(color)
	g=rgbg(color)
	b=rgbb(color)
	newcolor=rgb(255-r,255-g,255-b)
endfunction newcolor
 
`Made by Obese87
function round(n#)
   a=n#+n#
   b=n#
   n=a-b
endfunction n