Skip to content

Instantly share code, notes, and snippets.

@csilverman
Created April 27, 2020 20:32
Show Gist options
  • Save csilverman/31def710bee53f1055eadccbe8f1d3c5 to your computer and use it in GitHub Desktop.
Save csilverman/31def710bee53f1055eadccbe8f1d3c5 to your computer and use it in GitHub Desktop.
-- H.Zimmerman, AppleScript.
-- Create text file in current Finder folder with a dialog.
tell application "Finder"
try
display dialog "name of doc please (without the .txt thing)" default answer ""
set fileName to the text returned of result
if length of fileName = 0 then
return 0
end if
set fileExt to ".txt"
set thisFolder to the target of the front window as alias
set newFile to fileName & fileExt
make new file at thisFolder with properties {name:newFile, file type:"TEXT", creator type:"ttxt"}
on error errMsg
display dialog (errMsg)
end try
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment