Quote: "it just shows a black screen"
This is a bad sign but I did get rid of your SYNC.
` Here's the code with SYNC
find first ` Gets rid of .
find next ` Gets rid of ..
repeat
find next
print "ext:"+FindFileExtension(get file name$())
`printC "file name= "+get file name$()
`print " file type = "+str$(get file type())
until get file type()=-1
` Update the screen
sync
` Wait for a keypress
wait key
end
Function FindFileExtension(filename$)
` Search the entire string one character at a time
for t=1 to len(filename$)
` Check for the period
if mid$(filename$,t)="."
` Extract all characters after the period (grabbing from the right side of the string)
Fileexten$=right$(filename$,len(filename$)-t)
` Leave the for/next loop
exit
endif
next t
endfunction Fileexten$
The other method I didn't mention is using IanMs Matrix 1 Utilities Plugin. His command SPLIT STRING works extremely well for extracting things using any divider including a period.
find first ` Gets rid of .
find next ` Gets rid of ..
repeat
find next
` Split the filename and extension (split it by every .)
split string get file name$(),"."
` Show the second split (the extension)
print "ext: "+get split word$(2)
` Show the first split (the filename)
printC "file name= "+get split word$(1)
print ""
`print " file type = "+str$(get file type())
until get file type()=-1
` Update the screen
sync
` Wait for a keypress
wait key
end
If you don't have it where have you been?
Get it here:
http://forum.thegamecreators.com/?m=forum_view&t=85209&b=18