Right-click file in Finder and open it in a new BBEdit window

101 views
Skip to first unread message

James Greenwood

unread,
Jan 13, 2024, 1:38:03 PMJan 13
to BBEdit Talk
Hi, I'm looking for a way to right-click a file in Finder and select an option to open it in a new BBEdit window. Currently I can only see a way (from Finder) to open a document in the existing active BBEdit window.

The existing process I use to achieve this is quite slow, so I'm looking for a faster replacement from this:
 1. I'm in Finder, looking at the file I want to open in a new BBEdit window
 2. Switch to BBEdit, then File > New > Text Window; make sure the new window is active
 3. Switch back to Finder, then double-click file
 4. In BBEdit, switch to the unwanted empty document that's also open in new BBEdit window
 5. Close the empty document
 6. Switch back to the document I just opened

Does anyone know a way to achieve this (ideally without needing a 3rd-party utility)?

Bruce Van Allen

unread,
Jan 13, 2024, 2:24:35 PMJan 13
to bbe...@googlegroups.com
What’s your BBEdit setting for Application -> Open Documents into the front window if possible ?

If it’s not checked, simply double clicking a file in the finder will open it in a new window.

Is that what you're after, or have I misunderstood your objective?

— Bruce

_bruce__van_allen__santa_cruz_ca_
> --
> This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
> ---
> You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/b248b216-03d0-4342-9e35-23307dddca3an%40googlegroups.com.

James Greenwood

unread,
Jan 13, 2024, 4:58:14 PMJan 13
to BBEdit Talk
Thanks Bruce. 98% of the time I want to open a text file as a new document in the active BBEdit window; while 2% of the time I want to open it in a new window so I can compare documents side-by-side. When I double-click, I'd like that to default to opening a file in the current window.

Ideally, when I right-click I'd like two options:
 1. Open File in BBEdit (default)
 2. Open File in BBEdit new window

Then if I double-click, it would open in the active window - except when I want to compare documents side-by-side, I'd right-click and select "Open File in BBEdit new window".

Now 2% of cases might not sound a lot, but I edit text files a lot and it happens often enough that I feel motivated to ask the question here!

Bruce Van Allen

unread,
Jan 13, 2024, 8:48:51 PMJan 13
to BBEdit Talk
An Automator workflow set as a Quick Action could work. Quick Actions are available when right-clicking a file in the Finder, among other ways.

In Automator start with “Files & Folders” -> “Get Selected Finder Items”, then add “Utilities” -> “Run Applescript”.

In the script pane that opens for Run Applescript, paste this after "on run {input, parameters}”:

tell application “Finder"
activate
set strFilePath to {}
tell application “Finder"
repeat with objItem in (get selection)
set end of strFilePath to POSIX path of (objItem as text)
end repeat
end tell
tell application “BBEdit"
activate
--open filePath opening in front_window
open strFilePath opening in new_window
end tell
end tell

Save this Automator Workflow Quick Action with a name you’ll recognize.

Now, when you right-click a file in the finder, the pop-up will have this script listed under “Quick Actions”.

Note the commented line "--open filePath opening in front_window". One suggestion would be make two of the quick actions, one using “front_window” and the other using “new_window” (there’s also “separate_windows”), naming them accordingly. Then they’ll both be available as quick actions that work regardless of BBEdit’s preference.

Also note that this little script uses a klunky way to get the path of the selected file into the right form to hand to BBEdit, but it was the only one I could get to work. Maybe some of this list’s scripting adepts can point out a better way.

HTH

— Bruce

_bruce__van_allen__santa_cruz_ca_
> To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/db8a262a-3c1b-403a-96a8-724bf2c8c09fn%40googlegroups.com.

fgf

unread,
Jan 13, 2024, 11:53:24 PMJan 13
to BBEdit Talk
the way I do it is
  double click as usual to open the file into the active window, then
  View -> Move to New Window    or    opt-cmd-O
which moves that most recent file in the active window into its own new window...

James Greenwood

unread,
Jan 14, 2024, 12:59:57 PMJan 14
to BBEdit Talk
Thank you for this solution!

Actually I think fgf's solution is good enough for me - it's a lot faster than what I was doing, so I'll use that for now.

James Greenwood

unread,
Jan 14, 2024, 1:05:28 PMJan 14
to BBEdit Talk
Thanks fgf, I didn't realize you could do this - and the fact that there's a keyboard shortcut (which I can remember) makes it even better!

This means opening a file in a new window is effectively a two-step process:
 1. Double-click the file in Finder
 2. Press Opt-Cmd-O

Even though it's two steps rather than one, it feels fast to me because of the keyboard shortcut.

So I'll use this for now - but if it starts to annoy me, then I'll try Bruce's Automator script. Thanks again!

Reply all
Reply to author
Forward
0 new messages