Keyboard Maestro-Omnifocus-Obsidian Task Workflow

Inspired by @MacSparky in a recent screencast, I made a KM Macro that:

  1. creates an Omnifocus inbox task {name: selected text, note: Obsidian Note URL}
  2. converts the selected text to a markdown task & links to the OF task.

Script:

tell application "Keyboard Maestro Engine"
	set ObsidianURL to getvariable "ObsidianURL"
	set taskName to getvariable "taskName"
end tell

tell application "OmniFocus"
	tell front document
		set newTask to make new inbox task with properties {name:taskName, note:ObsidianURL}
		set taskID to id of newTask
	end tell
end tell

return taskID
3 Likes

Great work! Gonna steal this for my workflow :smiley:. Thanks!

1 Like

Another reason to be sad about using Obsidian and OmniFocus predominately on iPad!!

There should be a way to select text in Obsidian on your iPad and run a shortcut via the share sheet. Having OmniFocus shortcuts create the new task and return the task link may require you to go into Omnifocus automation scripting (JavaScript land).

Or look into MacStories Obsidian Plugin that allows you to run Apple Shortcuts from inside of Obsidian

2 Likes

That looks really good too. Thanks for sharing.

Well, @Kullenej showed me the rabbit hole of the Obsidian Shortcut Launcher from MacStories. It actually works pretty well.

If you install the plugin and make a launcher you can direct it to this Shortcut

The only catch is that there is no way to manipulate the selected text automatically in Obsidian. You just need to wait for a second and then you can paste the link in place.

Hello @Isaac, just signed in to MPUTalk, because I have a problem while setting up the Keyboard Maestro-Omnifocus-Obsidian Task Workflow from your initial post here. Precisely, while executing the workflow, it puts not the ObsidianURL to the note field of the OmniFocus-Task. Instead it fills in the link to the task itself, what is nonsense, of course.

Am I doing something wrong? Sorry, I’m new to KeyboardMaestro and the whole automation thing, but your workflow is kind of what I was looking for!

Thank you!

whenever I had scratched my head working in KM, the answer has more often than not been the need to add a Pause somewhere. You may want to add a 0.2-second pause between the [Copy] block and [set Variable “taskName”] block.


@emzett - This works…

Thanks for your reply. Unfortunately it isn’t working yet, even if I set the pauses to one second. The workflow ends like this:
OF, Screenshot workflow

That is the expected behavior. It changes the highlighted to that text that is a url link to the newly created omnifocus task. The new task in omnifocus inbox should have the obsidian return-link in the notes of the new task.

Yeah, but the screenshot above is the OF notes field… Of course there should be the return-link to obsidian. In Obsidian everything is fine, showing the link to the created OF task.
I’ll fiddle around with the KM workflow, must be a way to make this running.

@Isaac, one more question concerning the KM workflow: what does the first action “Type the ^U Keystroke” do?

Thanks a lot!

Control U is the hot key for copy obsidian url. You should check to see if this true for your set up. You can set the hot key for whatever you want and just change the keystroke in KM