recursion limit when creating file list of harddrive
JB
sundown at pacifier.com
Thu Oct 29 16:47:20 EDT 2015
This is a mouseUp handler to be used with
Geoff Canyon’s function directoryListing.
Paste the code below in field script and
set the lock text of the field to true.
I had a bug in the last version and used the
word controlKey twice in the launch script.
It is now corrected to use controlKey and
commandKey.
JB
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 commandKey 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