In Finder > Select a folder > Right click, we get a popup with an option to create a new folder:
Is there a way to add menu item New Textfile
for adding a new text file?
In Finder > Select a folder > Right click, we get a popup with an option to create a new folder:
Is there a way to add menu item New Textfile
for adding a new text file?
You could assign a shortcut to a script like this:
tell application "System Events" to tell process "Finder"
value of attribute "AXFocusedWindow" is scroll area 1
end tell
tell application "Finder"
if result is true or number of windows is 0 then
set t to desktop
else
set t to target of Finder window 1
end if
set f to make new file at t
if t is desktop then
set selection to f
else
select f
end if
end tell
There is a bug in 10.7 and 10.8 that affects many other scripts and Automator services like this. Finder ignores new windows when getting the insertion location
and selection
properties. If you open a new Finder window, select some items in it, and run tell app "Finder" to selection
in AppleScript Editor, the result is the items selected in some window behind the frontmost window (or an empty list). One workaround is to move focus to another application and back, but it results in a visual glitch.
So neither of these ways of checking if the desktop is selected work reliably:
tell application "Finder"
insertion location as alias is desktop as alias
container of item 1 of (get selection) as alias is desktop as alias
end tell
You could also wrap the script as an Automator service, but there is another bug where the shortcuts for Automator services don't always work until you hover over the services menu from the menu bar. If the input type was set to no input, the service wouldn't show up in context menus. If it was set to folders or files, you'd have to always secondary-click some folder or file.
Related questions:
I didn't vote to close this question, because many of the solutions in the other questions are affected by either of the two bugs mentioned above. We'll likely get even more questions like this, which could then be closed as duplicates of this question.
I am using XtraFinder plugin for Mac OS's built in Finder. It has most of the features including create new file in finder options.
You'll love it like I do
;)
There is a new APP in the store: https://itunes.apple.com/us/app/new-file-menu/id1064959555?ls=1&mt=12
New File Menu allows you to create new files quickly via the Finder context menu.
Important: New File Menu is implemented as a Finder extension, you need to enable "New File Menu Extension" in "System Preferences » Extensions" to make the context menu appear.
You can try New File Menu Free (the free version of New File Menu, mentioned in other answers), it's free and working fine, although it only supports one extension at a time:
New File Applescript with Toolbar Icon
Found this open source gem. Can either use the .App or add the Applescript manually. Will add a New File widget to the Finder toolbar.
Edit: I couldn't get the above working as a Service but then I found a dialog hiding behind everything else where Finder was asking for permission to use the accessibility features. Once I'd enabled that the answer from Lauri Ranta worked. But the one below works well and doesn't need extra permissions.
I've tried several ways, the cleanest I've found is the Automator script provided here:
http://oscargodson.com/posts/new-file-in-right-click-context-menu-for-mac.html
And available from Github here:
There is a little known feature of the Finder called Stationary Pad. Imagine having a pad of paper that you could "tear off" a new sheet from on your desktop. Each page in the pad could have a custom layout and pre-existing content etc, allow you to (for example) fill in a "while you were out, X called" memo.
I'm not as a Mac at present to get screenshots etc, but if you open up a text document, and then enter the details you want to be used as your template (bearing in mind a totally blank sheet is a perfectly valid template), then save it somewhere, right click and Get Info
, then click the Stationary Pad
tick box, then that file will subsequently behave differently from a normal file. Double clicking to open the file will actually open a copy of the file, without any filename set, as if it were a totally new document, allowing you to fill it in and save it with a name/location of your choosing. The great thing about this is that without unticking the stationary pad option, you cannot accidentally overwrite or otherwise modify the original template.
There is more info if you google, this is a brief summary with helpful commens that isn't too old.
This isn't quite right clicking on the desktop and clicking "New File", but if your template icon is on the desktop it's arguably faster (depending on if you are faster at locating an icon and double clicking, or using any white space, right clicking then choosing from a context sensitive menu...)
Alternatively, you could use a combination of one of the scripted methods shown in other answers to get them to simply open a Stationary pad file, and you can recreate the "create blank" feature nicely from any App, even ones that don't support Applescript, and the "blank" document doesn't even have to be blank, but can be a template.
If you use Alfred, you can try this workflow. http://www.packal.org/workflow/create-new-file-finder-file-type-templates
Then you can type "new" in Alfred to create a new file in the current folder.
New File Menu.app can be configured to provide an experience familiar to Windows users if that's what you're after.
To achieve this, purchase New File Menu.app for $1.99 from the Apple App Store
Configure the General settings as seen in the image below:
Under Templates, rename the Text File
Title to Text Document
and the Prefix NewFile
to New Text Document
. Uncheck all other enabled templates.
If you download and install BetterTouchTool you can set up this action easily; it's one of the built-in available triggers.
Better yet, you can set it up for any keyboard shortcut or trackpad gesture you like. (Including a lot of trackpad gestures you didn't know existed.)
(I'm not affiliated with BTT in any way, but I do feel that a lot more Mac users should be using it. It is the first application I install on any new Mac and I've been using it for over five years.)
High Sierra: Go to System Prefs/Keyboard/Shortcuts, choose SERVICES and check "Open Selection in a TextEdit window". It will show up in your Services menu now. You can add a hotkey there too.
This also works pretty well if you're willing to spend a bit of money: https://langui.net/new-file-menu/