I am having difficulty making a script that will take a selected folder (not opened) and transfer the folder name as well as all subfolders and file names in those folders to TextEdit. Anyone have any suggestions
That’s a fairly abstract request. What kind of information do you want to display? just file names , or paths? or paths from the selected folder?
it’s trivial to get a list of file paths:
which can then be passed to Text Edit in a number of ways:
[This script was automatically tagged for color coded syntax by Convert Script to Markup Code ]
but I’m guessing that’s not quite what you want…
jonn8
March 13, 2005, 8:49am
#3
With a little more code it probably is:
–Open this script in a new Script Editor window.
set name_only to false
tell application “Finder”
try
set f to (get selection )'s item 1 –try to get the currently selected folder
if f ’s class is not folder then
activate
set f to (choose folder )
end if
on error
activate
set f to (choose folder )
end try
if name_only then
set e to name of f ’s entire contents
else
set e to f ’s entire contents
end if
end tell
set filelist to {“Contents of " & f & return & return }
repeat with i from 1 to (count e ) –convert the references to path strings
set end of filelist to (”" & e ’s item i & return )
end repeat
tell application “TextEdit”
make new document at beginning with properties {text :filelist as Unicode text }
activate
end tell
Jon
[This script was automatically tagged for color coded syntax by Convert Script to Markup Code ]