This seemed deceptively simple, but it doesn't work quite right.
OmniFocus 4 has a Service for Safari called "OmniFocus 4: Send to Inbox" which appears in the Services menu only if the Safari URL is highlighted. The Service makes a QuickEntry from the URL and Page Title.
I built a macro that highlights the URL, Pauses Until the Service exists and then triggers the Menu item.
When I trigger the Macro, it doesn't work, but if I trigger it a second time, it does.
I've tried adding Pauses, selecting the URL twice with an ESC between -- nothing works. First time fails, second time works fine.
Oh, and I tested to make sure that it was getting past the pause, and it does. When I added a timed pause after the Pause Until, it still doesn't work.
Any help appreciated.
I constantly build OmniFocus 4 automations and use the app frequently.
Out of my house, now. But I will try to look into this issue tomorrow.
I created this JXA script and KM macro. Let me know if it works for you:
return (() => {
"use strict";
// Copyright (c) 2023 Gabriel Scalise
// Twitter - @unlocked2412
// jxaContext :: IO ()
const jxaContext = () => {
const main = () => {
const
ofApp = Application("OmniFocus"),
seApp = Application("System Events"),
safariApp = Application("Safari"),
oWin = ofApp.defaultDocument.documentWindows[0],
qe = ofApp.quickEntry,
// paths = map(strip)(splitOn(",")(input)),
tabTitlePair = safariTabTitleURL(safariApp),
task = quickEntryTask(ofApp)(qe)(tabTitlePair[0])(
tabTitlePair[1]
)(Nothing());
treeWithId(qe)(task.id()).selected = true
ofApp.activate()
seApp.keystroke("e", {
using: "command down"
})
};
// FUNCTIONS ---
// safariTabTitleURL :: Application -> (String, String)
const safariTabTitleURL = app => {
const
wins = app.windows,
tab = wins[0].currentTab;
return Tuple(
tab.name()
)(tab.url())
};
// treeWithId :: Tree -> String -> OF Tree
const treeWithId = qe => strID =>
qe.trees.whose({
id: strID
})()[0];
// quickEntryTask :: Application -> String -> String -> Maybe FilePath -> OF Task
const quickEntryTask = ofApp => qe => name => note => mbFilePath => {
const
oTask = ofApp.InboxTask({
name: name
}),
qe = ofApp.quickEntry;
qe.open()
qe.inboxTasks.push(oTask)
oTask.note = note
if (!mbFilePath.Nothing) {
oTask
.note
.fileAttachments
.push(
ofApp.FileAttachment({
fileName: Path(
mbFilePath.Just
),
embedded: true
})
)
}
return oTask
};
// GENERIC FUNCTIONS --------------------------------------------
// https://github.com/RobTrew/prelude-jxa
// Just :: a -> Maybe a
const Just = x => ({
type: "Maybe",
Just: x
});
// Nothing :: Maybe a
const Nothing = () => ({
type: "Maybe",
Nothing: true
});
// Tuple (,) :: a -> b -> (a, b)
const Tuple = a =>
// A pair of values, possibly of
// different types.
b => ({
type: "Tuple",
"0": a,
"1": b,
length: 2,
*[Symbol.iterator]() {
for (const k in this) {
if (!isNaN(k)) {
yield this[k];
}
}
}
});
// MAIN --
return main();
};
return jxaContext();
})();
Download Macro(s): OmniFocus 4- Send Safari Tab Title & Name to Inbox.kmmacros (5.2 KB)
Macro-Image
Macro-Notes
- Macros are always disabled when imported into the Keyboard Maestro Editor.
- The user must ensure the macro is enabled.
- The user must also ensure the macro's parent macro-group is enabled.
System Information
- macOS 14.3.1
- Keyboard Maestro v11.0.2
Thank you very much! It works, but it activates OmniFocus instead of just opening the QuickEntry window. Is there a way to have the script populate the QE window without opening OF?
If it's a headache, I can just hide OF and reactivate Safari in the macro.
Let me know. Thanks again for the help.
You're welcome
I see OmniFocus opens when I use the "OmniFocus: Send to Inbox" service. Could you check that in your machine ?
Checked it; it just opens the QuickEntry and leaves Safari open underneath. No sign of OF4.
Would be possible that you show a video? Perhaps there is a subtle detail there.
Attempted many times, but in every case OmniFocus 4 opens in the background. I am closing OmniFocus 4, and then clicking on the Service.
I have OF4 running but hidden. Here is a screencap:

Thank you.
Ah, but OF4 is running, but minimized. That matches what I am seeing here. I'll see what I can do.
What happens if you minimize OmniFocus and then run the macro. Does OF 4 appear ?
By minimized, I'm assuming you mean hidden with the yellow dot in the ULC of the window.
When OF4 is minimized, activating the QE Service does not bring up OF4. It's just like the GIF above.
Yes, exactly.
Could you please explain what happens in that case if you use my macro? I am asking because OF4 doesn't appear if it is hidden as well.
Using the Services Menu, the OF4 Quick Entry window appears without bringing up the main OF4 window, whether OF4 is open behind Safari, hidden, or minimized.
Using your macro, the OF4 window is called up with the QuickEdit window if OF4 is hidden or the window is behind Safari. If OF4 is minimized, then your macro does not call the OF4 window up when opening the QE window.
My mistake, turns out your script calls up OmniFocus even if it's minimized, but only the menu bar is visible.
Hi @anamorph, I have been investigating this issue.
So, does that match what you are seeing using the service ?
I tried to call OmniFocus service. When I do that, OmniFocus appears at the front.
No, the Service Menu does not bring up OmniFocus. It doesn't matter whether OmniFocus is open behind Safari, hidden or minimized.
In my case, the service brings OmniFocus 4 to the front. I wonder what's the difference between our systems. Could you tell me exact OF 4 and macOS ?
MacOS Ventura 13.5 (22G74)
OmniFocus 4.0.5 (v174.9.1)
Thank you for trying to work this out.
I don't know if you want to spend any more time on this; I found a brute-force workaround.
I tried recording the macro in real time, and it still fails. I think it's something funny in the Select Menu action.
I ended up removing the Select Menu action from the recorded version and using keystrokes to navigate to the menu. Now it works every time. Here is the macro:
@anamorph, I think I did it.
No sign of OF as you can see. Please test and let me know.

Download Macro(s): OmniFocus 4- Send Safari Tab Title & Name to Inbox.kmmacros (5.0 KB)
Macro-Image
Macro-Notes
- Macros are always disabled when imported into the Keyboard Maestro Editor.
- The user must ensure the macro is enabled.
- The user must also ensure the macro's parent macro-group is enabled.
System Information
- macOS 14.4
- Keyboard Maestro v11.0.2