I haven't made a KM macro from scratch in a while and I am forgetting how to take text in, manipulate it, and paste the changed text back out to where it came from. Any clarification would help at this point.
I am using a Typinator script to pull results for my calendar using icalbuddy. Problem is, I don't like the way icalbuddy formats the text output and the creator of icalbuddy hasn’t shown any interest in revising his script for a long time so, it is what it is. I am trying to solve the problem using a KM macro.
To do this I need to understand something that is, as Jimmie Buffet once said, so simple it has plumb evaded me. KM has a copy command and a copy to named clipboard command (and others of course). But then using an option-x keystroke will also cut (copy) and ... I think I can do all this with key commands on the text that will be on the clipboard - and then paste back the results.
This is the basic idea, I want to take this;
Mon, Jan 28:
(------------------------)
• VA imaging
2:00 PM - 3:00 PM
And turn it into this;
Mon, Jan 28: 2:00 PM - 3:00 PM VA imaging
This is not too hard to do using keystroke to go to the end of a line, copy, paste, up arrow, repeat, down arrow, etc. It will normally have several items separated by a space so I will have to use some sort of a loop but, first things first. How to 1) copy the text block 2) apply all the changes to what I have copied to that captured text block, and 3) paste my newly formatted results back where the macro was triggered.
Thanks.
ADDED: I just got it working using the cut and paste in real time on the document. I asked the question to understand how I could do the following on the KM clipboard and then paste the results back to the document.
This method works pretty well. I have it parse an entry and then delete to the beginning of the next entry. Hitting the key trigger again is no big deal although using the clipboard and looping might be an easier way.
In case anyone is wondering, using the ...
Type the ⇧⌘Right Arrow Keystroke
Type the ⇧⌘Left Arrow Keystroke
... together ensures I select the entire line as the preceding line will likely leave my cursor not at the lines beginning and a simple down arrow to select the line needs the whole line.
Type the Forward Delete Keystroke
Type the ⇧⌘Right Arrow Keystroke
Type the Right Arrow Keystroke
Type the Tab Keystroke
Type the Down Arrow Keystroke
Type the Down Arrow Keystroke
Type the Down Arrow Keystroke
Type the ⇧⌘Right Arrow Keystroke
Type the ⇧⌘Left Arrow Keystroke
Type the ⌘X Keystroke
Type the Up Arrow Keystroke
Type the Up Arrow Keystroke
Type the Up Arrow Keystroke
Type the ⇧⌘Right Arrow Keystroke
Type the Right Arrow Keystroke
Type the ⌘V Keystroke
Type the Tab Keystroke
Type the Down Arrow Keystroke
Type the Down Arrow Keystroke
Type the ⇧⌘Left Arrow Keystroke
Type the ⇧⌘Right Arrow Keystroke
Type the ⌘X Keystroke
Type the Up Arrow Keystroke
Type the Up Arrow Keystroke
Type the ⇧⌘Right Arrow Keystroke
Type the Right Arrow Keystroke
Type the ⌘V Keystroke
Type the Down Arrow Keystroke
Type the ⇧⌘Left Arrow Keystroke
Type the ⇧⌘Right Arrow Keystroke
Type the Delete Keystroke
Type the Forward Delete Keystroke
Type the Forward Delete Keystroke
Type the Forward Delete Keystroke
Type the Forward Delete Keystroke