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_


> On Jan 13, 2024, at 1:52 PM, James Greenwood <[email protected]> wrote:
> 
> 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!
> On Saturday, January 13, 2024 at 7:24:35 PM UTC Bruce Van Allen wrote:
> 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_ 
> 
> 
> 
> 
> 
> > On Jan 13, 2024, at 10:34 AM, James Greenwood <[email protected]> wrote: 
> > 
> > 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)? 
> > 
> > -- 
> > This is the BBEdit Talk public discussion group. If you have a feature 
> > request or need technical support, please email "[email protected]" 
> > 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 [email protected]. 
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/bbedit/b248b216-03d0-4342-9e35-23307dddca3an%40googlegroups.com.
> >  
> 
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "[email protected]" 
> 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 [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/db8a262a-3c1b-403a-96a8-724bf2c8c09fn%40googlegroups.com.

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "[email protected]" 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/B63030BA-AD0F-4364-AC4C-8FC3E1A81732%40cruzio.com.

Reply via email to