Macro for Omnifocus

I'm trying to create a seemly easy macro. The goal is to take an existing task in omnifocus, create a new task, and append a name to the beginning of the task's title.

I believe the right way to do this is:

  1. Copy just the task's title (Cmd-C), or use the Menu Selection, save to variable as OldTaskName.
  2. Copy the task in TaskPaper format, which preserves additional info about the task (due dates, tags, etc). There's no keyboard shortcut, so I use the menu selection action. (Edit-> Copy as TaskPaper). This is in now in the System Clipboard.
  3. Ask user for name to preprend to task's title, save as WhoWait.
  4. Search for OldTaskName in system clipboard and prepend WhoWait.

What I see if I execute this is that it works every other time. I know something is wrong with the way things are moved in/out of the system keyboard because if I set the system keyboard to an empty text at the beginning, the macro never works. However, I can't figure out why this is happening. Any ideas?

The macro is attached, and the steps are below:

Create Waiting Item.kmmacros (5.0 KB)

Just FYI, it is usually better to use the menu item rather than a keyboard shortcut within your macros. Prevents unintended edge cases. You are doing this, but you mentioned that it is by necessity. You should continue to do it all the time.

Thanks @vincent_ardern, good to know!