Create new text file on desktop via Finder's context menu Macro (v11.1)

By clicking with the right mouse button on an empty space of your desktop and selecting “New Folder” you can create a new text file “New file.txt” on your desktop. You could modify this macro to copy a .docx template to create a new Ms Word document etc. on the desktop. (You could even add a small menu to select new LibreOffice, new Python script etc.)

Demo:

Image-003309

The downside of this approach is that it’s no longer possible to create … a new folder on the desktop.

Question: Is there a way to use a modifier (like the Option key) to have the finder create a New folder as usual?

Create new text file on desktop via Finder's context menu.kmmacros (4.7 KB)

-N

1 Like

Well, I suppose I didn’t answer your question. I’m pretty sure the answer is yes but I’ll leave the matter to those who also like to do things that way (I use the keyboard rather than a pointing device in most situations!).

Just in case it’s of interest, here is a macro to create a new text file. Maybe it will give you some fresh ideas, even though it’s not quite what you asked for!


New file..kmmacros (20.5 KB)

1 Like

Finder Style Menu Macros.kmmacros (39.0 KB)

I have now changed the macro to call a context menu:

Image-003312

The Run Macro… item code is borrowed from:

Name: Execute Macro by Name
Version: 0.1
Updated: 2024/08/10 09:16 PT
By: Dan Thomas

You might perhaps be interested by this Alfred workflow, which includes a way to use templates for new files. The workflow is ten years old but it still works. Its core is a Ruby script.

Create New File in Finder for Alfred 2.0 - Ian Nebbiolo

1 Like

Your original macro could use the Modifiers condition to detect whether the Option key was down and disable it's normal behaviour and leave the folder unmodified (or vice versa).

3 Likes