Since I was using the Finder for several things anyway, I decided to do away with list folder.
Good feedback — thank you.
------------------------------------------------------------------------------------------------
# Created: 2012-10-26 : 01:27
# Modified: 2012-10-26 : 16:17
# Application: Finder
# Purpose: Create a new file from a file-type list in the front Finder window.
# Dependencies: Template files provided by the user.
# Templates: Applescript, Text (so far)
------------------------------------------------------------------------------------------------
try
try
set templateFolderPath to ((path to application support from user domain as text) & "Script_Support:New_File_Here!:")
set templateFolder to alias templateFolderPath
on error
set _temp to quoted form of (POSIX path of templateFolder)
do shell script "mkdir " & _temp & "; open -R " & _temp
return
end try
tell application "Finder"
if front window exists then
set winTarget to target of front window as alias
set fileTemplateList to name of files of templateFolder
tell me to set fileType to choose from list fileTemplateList with title "New_File_Here! Templates" with prompt ¬
"Pick One:" default items {get item 1 of fileTemplateList} with multiple selections allowed
if fileType ≠ false then
set AppleScript's text item delimiters to (return & templateFolderPath)
set itemsToCopy to paragraphs of ((templateFolder as text) & fileType)
repeat with i in itemsToCopy
set i's contents to i as alias
end repeat
set copiedFiles to duplicate itemsToCopy to winTarget
select copiedFiles
end if
else
error "No windows open in Finder!"
end if
end tell
on error e number n
return e
set e to e & return & return & "Num: " & n
tell me to set dDlg to display dialog e with title "ERROR!" buttons {"Cancel", "Copy", "OK"} default button "OK"
if button returned of dDlg = "Copy" then set the clipboard to e
end try
------------------------------------------------------------------------------------------------