recursion limit when creating file list of harddrive
JB
sundown at pacifier.com
Wed Oct 28 22:30:27 EDT 2015
I improved the mouseUp handler. Now you can set
the desired level at the top of the handler and you
can launch applications and folders in the finder.
on mouseUp
put 1 into cNum
if target = empty then
answer folder "Pick a folder you want to walk:"
put it into whatFolder
set cursor to watch
put directoryListing(whatFolder,cNum) into target
exit to top
end if
if the controlKey is down and the optionKey is down then
put empty into target
exit to top
end if
if the controlKey is down and the controlKey is down then
put word 2 of the clickline into tLine
put line tLine of target into tLaunch
launch document tLaunch
exit to top
end if
if the controlKey is down then
put word 2 of the clickline into tLine
put line tLine of target into whatFolder
set itemDel to "/"
delete last item of whatFolder
set cursor to watch
put directoryListing(whatFolder,cNum) into target
exit to top
end if
if the optionKey is down then
set itemDel to "/"
sort lines of target descending by last item of each
exit to top
end if
if the commandKey is down then
set itemDel to "/"
sort lines of target ascending by last item of each
exit to top
end if
put word 2 of the clickline into tLine
put line tLine of target into whatFolder
set cursor to watch
put directoryListing(whatFolder,cNum) into target
end mouseUp
function directoryListing whatFolder,c
put whatFolder & cr into R
set the directory to whatFolder
if c = 0 or the result is not empty then return R
put the files into tFileList
sort tFileList
replace cr with cr & whatFolder & "/" in tFileList
put whatFolder & "/" & tFileList & cr after R
put line 2 to -1 of the folders into tDirList
sort tDirList
repeat for each line L in tDirList
put directoryListing((whatFolder & "/" & L),(c-1)) after R
end repeat
return R
end directoryListing
More information about the use-livecode
mailing list