John Craig wrote:
One example is needing the size of a file in a folder of thousands.
Creating the output generated by 'the files' is not economical in this case.
Test:
Make a stack with one button containing the script below, and one field
named "r". I set the tabstops of the field to 300, and turned on the
vGrid and hGrid for column cropping.
Result:
# Files: 12883 Total: 3650ms Per file: 0.283319ms
Code:
on mouseUp
-- Get folder:
answer folder "Select a folder:"
if it is empty then exit to top
--
-- Run function, with timing:
put the millisecs into t
put FileListInfo(it) into tmp
put the millisecs - t into t
--
-- Display function result in field, and test result in Msg:
put tmp into fld "r"
put the number of lines of fld "r" into n
put "# File: "&n&" Total: "&t &"ms Per file: "& t/n &"ms"
end mouseUp
function FileListInfo pDir
-- Get list of file info:
put the directory into tSaveDir
set the directory to pDir
put the detailed files into tFileList
set the directory to tSaveDir
-- Parse for display:
put empty into tFileInfo
repeat for each line tLine in tFileList
put urlDecode(item 1 of tLine) &tab& \
item 2 of tLine + item 3 of tLine &cr after tFileInfo
end repeat
--
return tFileInfo
end FileListInfo
--
Richard Gaskin
Managing Editor, revJournal
_______________________________________________________
Rev tips, tutorials and more: http://www.revJournal.com
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution