Action to process non-consecutively selected lines of text

Hi,

I want to take non-consecutively selected lines of text in a Taskpaper draft and send them to OmniFocus using an Action. I tried adding ‘getSelectedText’ instead of “getText” in Rosemary Orchard’s ‘Taskpaper to OF’ action. It works fine for the first selected text block, but the remaining blocks aren’t processed. Could someone recommend/provide an approach to make this work? P.S. I looked around at other actions but received the same results when I tested. If I missed something, let me know that as well.

Edited:
I’m adding an image in case non-consecutively selected lines of text needed to be clarified or more specific for folks to assist. Essentially, I’d want Task 1 with a note and Task 3 with a note to be sent to OF. To do that now, I’ll have to use the modified action with ‘getSelectedText’ twice to achieve this. The original action brings the entire content of the note. Alternatively, if it is easier, I’d be okay with excluding lines of text, e.g., between a set of characters, such as // text //, to get the desired outcome.

image

Thanks!

Drafts does not support multiple text selections in any particular way. Your selected text is always the initial range.

You would need to parse items out of a draft based on some other process than a selection to pass arbitrary content. That might be prompted to select lines, or by using some markup that is specific to the lines you want to send that would allow a script to identify and separate them.

Hi,

Thanks for the response and information!

I thought that might be the case, but I wanted to ensure I wasn’t missing something. Do you know of an example action or reference that might help me put something together? I’m leaning towards your second option, parsing based on some markup that would be in or possibly wrap the lines I want.

Best regards.

I don’t know if this option does what you want, but if you:

  • Select the first task and use a PopClip extension to copy it.
  • Select the second task and use a PopClip extension to append it to the clipboard.
  • Go to the OmniFocus Inbox and paste the clipboard…

Then OmniFocus will accept the pasted information as correctly formatted tasks. Notes will be added correctly. You can add Action Groups in the same way, assuming the indent relationship is created in Drafts before copying.

There is probably a way to modify the existing action to work with the clipboard vs a selection - but I’ve not tried that. PopClip is a Mac-only option, so that is a limitation that might not be acceptable.