Open current BBEdit document in Marked 2

I’m still amazed how long I can do something before realizing “Oh right, I should automate this.” You’d think I’d have learned by now.

Today’s example: I’m constantly opening a BBEdit file in Marked. Now, I do have a BBEdit script to do this so I can go to the Script menu in BBEdit and then select “Open in Marked” but I hate using the trackpad, so why didn’t I make a keyboard shortcut for this ages ago?

Then, when I went to do that, I realized: “Wait. When I open a BBEdit file in Marked, the next thing I do is put the BBEdit window on the left, and the Marked window on the right. And if the dock (which I keep on the left) is visible, I want to hide that, so I can maximize screen space on my MacBook Air.”

So instead of just making a keyboard shortcut to do one thing, I made a macro that does all of the things:

  1. Runs a shell command defaults read autohide to see if the dock is hidden or not. If hidden, run keyboard shortcut ⌘⇧D to hide the dock.

  2. Resize front BBEdit window to left “column” / left side of the screen.

  3. Select the Script menu in BBEdit and run my Open in script (this uses a BBEdit variable for the front-most document, so it’s easier to do it this way than via Keyboard Maestro.)

  4. The script opens Marked (technically Marked 2)

  5. Keyboard Maestro waits until Marked has launched, is front-most, and has a window with a title, then moves it to the right “column” / right side of the screen.

  6. Activates BBEdit again so keyboard focus will be back in my BBEdit document.

Again, not hard, not very complicated, but I will use this all the time.

Installing the BBEdit Script

To install the BBEdit script, select the “Scripts” item from the BBEdit menu and choose “Open Scripts Folder” as shown here:

You can download my ‘Open in Marked’ BBEdit script from GitHub.

It’s pretty straight-forward. What you want to do is this:

open -a ‘Marked 2' "$BB_DOC_PATH"

If you use Setapp, you need to change it slightly to this:

open -a 'Marked' "$BB_DOC_PATH"

My script will check for the app and both places, and use whichever one exists. If neither exists, it will throw an error.

Here's the macro

I think it's pretty self-explanatory, but feel free to ask questions if you have any.

Download the Macro

BBEdit - Open in Marked.kmmacros (58 KB)

Nice one.

I have used this a bit more simple one. Does not change focus afterwards or move windows.

Open in Marked Macro (v9.0.4)

Open in Marked.kmmacros (2.3 KB)

1 Like

I like that yours does not require the user to setup a separate script inside BBEdit. That's definitely easier.

1 Like