Omnifocus: copy paragraph of text, but paste first line in field1 and the rest in field2

Hi all, i searched across the keyboard maestro forum and googled, however could not find the macros i am looking for. i am almost certain it has been done before…

I’m a user of omnifocus (task manager). In the task manager, it allows me to enter in 2 primary fields
(i) the task
(ii) the notes/ description.

When i copy paragraphs of text on a webpage which may spans over multiple lines AND has paragraphs.
I’d like to get Keyboard Maestro to put
(i) first line into the task field (field1)
(ii) the rest of the copied text into the notes/ description field (field2)

I am not a programmer and would have no clue how to go about doing the following:
a) how to run some text parser to take the first line and find a RETURN key and put that into a variable1
b) copy all of the same text again to put into variable2 ( copy all the same text, as you don’t need to program to find the difference; unless it was already given)

then some command to call back those variables1 and variables2 when needed to paste into required application?

Here's something to get you started. I didn't check for return characters but you can add that to the third action if useful.

This macro assumes that OM is running, and creates the tasks for you. Change "CONTEXT" and "PROJECT" as appropriate, but leave the quotes. You can also add defer and due dates, etc.

I've only tested it briefly, you may need to make adjustments depending on your setup and needs.

Make OmniFocus From Clipboard (Paragraph).kmmacros (4.3 KB)

You can do a lot of neat OmniFocus stuff with AppleScript. Here's one I use all the time to create this task:

set taskName to "List some items on eBay"

set defDate to (current date)
set day of defDate to (defDate's day)
set time of defDate to (3600 * 8) --time in hr/24

set dueDate to (current date)
set day of dueDate to (dueDate's day)
set time of dueDate to (3600 * 12) --time in hr/24

tell application "OmniFocus"
	tell front document
		set theContext to first flattened context where its name = "Work"
		set theProject to first flattened project where its name = "Work Actions"
		tell theProject to make new task with properties {name:taskName, context:theContext, defer date:defDate, due date:dueDate}
	end tell
end tell

There's a pretty good community on the OmniFocus Forum, too.

1 Like