Create a new text file in current folder of the current Finder window

This is just an apple script. I assign it to a keyboard shortcut key (ctl-cmd-n) and an touch bar button for Finder. I don't need the right click menu for that anymore

tell application "Finder" to make new file at (the target of the front window) as alias

How did you get a right click menu for this? It seems handy to me

I didn't create a right click menu item, just assigned hot key ctrl-cmd-n to it, like shift-cmd-n for creating new folder.

oh, alright. I’ll try this script out.

BTT already has this function build inside. However it only creates .txt files, but I would like to be able to create .rtf files. Any chance to get this working through btt? Thank you

You can have an empty rtf file as template somewhere and change this script to copy that file as your new rtf


this is the script that BTT uses internally adapted to create rtf files:

	tell application "Finder" to set the currentFolder ¬
		to (folder of the front window) as alias
on error -- no open folder windows
	set the currentFolder to path to desktop folder as alias
end try

set fileName to text returned of (display dialog ¬
	"Enter name for new file:" default answer "newfile.rtf")
set absolutePath to POSIX path of currentFolder & fileName
do shell script "shopt -u xpg_echo; echo '{\\rtf1}' > \"" & absolutePath & "\""

Thank you, but its getting too complicated for me here. I will go on copying and pasting my empty .rtf file from the desktop for now. (would be glad anyway to select "create .rtf" fromt the BTT preferences one day). Thanks!

It's not complicated. Just assign that script to any action in BTT using the predefined action "Run Apple Script (blocking)"

One note: it won't work correctly while the BTT window is open.

1 Like

Ok I will do! I am just afraid that the script could change somethin in my system. Could you explain whats happening in the background?

I don't know what happened, but since the latest update (2.697) my keyboard shortcut for creating a new file does not work anymore.