On macOS I miss the right-click menu: New document. Can I rebuild it with BTT?

Hi,

I dislike macOS cause I can't use a windows right-click at any folder to create a blank document of pages numbers textedit. Instead I am forced to first open that App, then save it and then scroll to the place where it's needed.

Did anyone create a "rightclick create new document at that folder" - windows alike - for and with BTT? :slight_smile:

1 Like

You can do it yourself with a lot of effort with Shortcuts (or Automator Service), AppleScript and/or the BTT "show custom context menu" action. But it is easier via Finder Extension: ‎New File Menu im Mac App Store

1 Like

A Finder context menu item might actually be good idea for a new trigger type in BTT :slight_smile:

3 Likes

@Dirk thank you for sharing. There is a Lite version on the App store for free, too.
@Andreas_Hegenberg as I am 8-10h a day in front of my mac, BTT has the power to motivate me to dive deeper in AppleScript/Javascript and so on to really make use of its possibilities. In case, you will implement this new trigger type, how long do I have to wait?
Cause then, I will try to do my homework and rebuild that App :wink:

I implemented the basics yesterday after my post here :wink: Alpha should be available tomorrow.

1 Like

Hahaha, you found that kind of (job-) product which motivates you the best. :smiley:

Good idea!
I believe BTT has a predefined action on board for this, but this would create a new text file in the Finder using AppleScript, for example:

tell application "Finder"
	if exists Finder window 1 then
		set currentDir to target of front Finder window as alias
	else
		set currentDir to desktop as alias
	end if
	
	set counter to 0
	set temp to "New Textfile"
	set fileName to ""
	repeat while fileName = ""
		set check to (currentDir as text) & temp & ".txt"
		if file check exists then
			set counter to counter + 1
			set temp to "New Textfile" & " " & (counter as text)
		else
			set fileName to temp & ".txt"
		end if
	end repeat
	
	activate
	
	make new file at currentDir with properties {name:fileName, file type:"TEXT", creator type:"ttxt"}
	select file fileName of currentDir
	
	delay 0.3
	
	tell application "System Events" to tell application process "Finder"
		key code 76
	end tell
end tell
2 Likes

I'll post a very simple example once the alpha is available!

1 Like

Hallo,

I use the free Raycast app (https://www.raycast.com) and its 'Easy New File' extention (Raycast Store: Easy New File) to create new files at the active folder (it has a powerful template function to create new files...)

Thx,
Christian

P.S.: Raycast has also a BTT extention ! :grin:

1 Like

Downloaded. :smiley: Reminds me on Alfred? The BTT extention doesn't load up my user triggers, only the build in ones, no?

Over here all my BTT named triggers can be run
like so:

I use Raycast in combination with BTT mainly with Quicklinks & {placeholders}.
For example to quickly create/set variables...
like to:

In case you just need this 4.518 alpha (uploading now) adds a simple Finder Extension that can be configured in the "Automations, Named & Other Triggers" section in BTT.

Here is an example on how to use it:
FinderExtension2.bttpreset (11.7 KB)


When the context menu item is triggered, BTT will make these variables available that can be used e.g. in terminal commands or scripts:

BTTFinderContextMenuTargetPath (the path of the current folder)
BTTFinderContextMenuSelectedItemPaths (the paths of the selected items, separated by ;; )
BTTFinderContextMenuTriggeredUUID (the UUID of the context menu item in BTT)

6 Likes

Nice implementation!
Would it also be possible to create submenus?

yes, you can create submenus as well (just add a group in the menu configuration). The only limitation I found is that menu separator lines are not rendered for finder extensions.

1 Like

Ah! Ok!

Nice!
I hope in 365 days I am able to understand all possibilities which comes with this. Looking forward to dive deeper after a while.
Right now, I even can't see it clicking right mouse and get the macOS menu but without it; clicking "play" insight of BTT opens it but isn't creating any file anywhere. It's my fault :wink:

Make sure to enable the Finder extension, otherwise it won't show up :wink:

2 Likes

Good morning! Such a smart implementation. To let me enter which file I actually want to have, so straight forward.

Eh that finder extension I should have know since 3650 days already :smiley:

I am just curious: do you collect these presets anywhere for other new users? No one can re-read all past forum topics to filter them out. :wink:

I had to restart macOS for this to be available for selection.
However, this did not work under Ventura on my old MacBook.

True, apparently Xcode defaults to minimum deployment version macOS 14.4. I'll change that to macOS 13, it should work fine there as well.