I am trying to set up a quick macro in KM that selects text then looks for any line that ends with “@focus”. Then, I want to build a list with just those found lines (and paste it back).
This is a workaround to TaskPaper as it allows marking items with tags but when you want to see just the ones you marked it also shows all the headings and sub-headings. I only want to end up with an actionable list and no headings, extra lines, etc.
I know grep is powerful and I think KM can do this - although searching through KM library I did not get any hits for “grep”.
I should think this is pretty simple but I do not know how I should search for any line ending with “@focus" and then selecting that line? Sending the results to a list should not be too hard either (although I am not sure how this is done I have seen it done in AppleScript before).
Would someone please be so kind as to comment on how such a thing could be done?
Trying: Simulate key strokes: (select all, copy), search Clipboard with RegEx \bfocus\b (using the @ symbol messed up the RegEx syntax). Saving capture groups to variable: Clipboard3, display Clipboard3.
Result, macro ran but produced no results (there should have been six lines with @focus)
@levelbest, I hope you don’t mind that I renamed your topic to be more descriptive of your actual question, and to make it easier for others to find in a search.
You confused me with your first block. You went through all lines and numbered them first? Assuming this was part of your process but not sure if this is how I should start? For one thing I wont always have the exact number of lines each time … working through your example assuming it is OK to skip that first box (?)
[quote=“JMichaelTX, post:8, topic:6225”]
Do you mean this KM Action? This is just SAMPLE TEST data I made up.The only important part is those lines the END with your keyword, “@focus”. Replace the data in this Action with your actual data. [/quote] Yes, that one. I am starting from what is on the clipboard. That was just your notes (test data) as it were? OK, thanks.
[quote=“JMichaelTX, post:11, topic:6225”]
OK, I just uploaded a new version into my original post above.Please try the link again. It is a new URL.[/quote]
Thanks very much for all that. It did download the script after you updated it and with a little tweaking, it works perfectly. I really appreciate the help.