blog :: unforswearing.com

Create a New File in Finder


I am decidedly not a programmer, but I love recreating functionality found in non-free applications. The latest example of this is the New File menu app on Product Hunt. This application essentially provides the user with a method of creating new files on the fly, from any folder within finder. This is a wonderful tool that can be recreated with a little applescript. Open the Script Editor and enter the code below:

tell application "Finder"
set FoldName to selection as text
set FoldName to POSIX path of FoldName
set newfile to text returned of (display dialog "Enter file name and extension" default answer "")
set FileName to FoldName & newfile
set FileName to POSIX path of FileName
set FileName to quoted form of FileName
do shell script "touch " & FileName
do shell script "open " & FileName
end tell

Note: When using this script you must enter the file name and extension. Finder will automatically open the file in the default application. For example, creating “My Notes.txt” will open the new file in Text Edit (or your default application for .txt files).

To add the script to Finder, save as “New File” (without an extension) and click “cmd” while dragging the script from the folder to the Finder toolbar. You now have a quick shortcut to create a new file any time you need one, and you saved yourself a few bucks in the process.

back to blog
github :: audio / sound :: home