Closed Zettt closed 10 years ago
I have committed an update to this macro. It now uses "Insert Text by Pasting" which is much faster on expansion, but %|
(going back to cursor position) is still horribly slow. ad097865bdbd9c4b16c9e6cf8b6bcbeb36b164e4
I'll have to look into more options.
@nuclearzenfire Did you find a better solution to this yet?
For reference and credit. This is the original blog post: http://soitscometothis.net/post/a-modified-keyboard-maestro-macro-for-multimarkdown-footnotes
I haven't really found a better solution to make it faster universally. What I have done is create if/then statements to check if I'm in an app (like Bbedit or TextWrangler) that allows the setting of jump points and use those to remember the cursor position and jump back to it. This is not an elegant solution for everyone.
I've had some ideas while I've been typing this. Let me think about them and try some out and I'll get back to you.
Ok, this is quick and dirty, but is much faster. I'll clean it up and figure out how to post it later (I'm late for work). Basically, now, I select all the text to the end, save it, and then use that that and the variable inputs to paste everything at the end with the cursor in the original position. The problem is that KM seems to go back to that cursor position by manually hitting the back key, so if there is a lot of text it takes a long time.
What I changed it to is it cuts all the text before the cursor to one variable beforeCursor then gets all the text after the cursor to variable afterCursor. It them pastes: %Variable%afterCursor%
Uses ⌘ up arrow to go to the beginning of the document and pastes: %Variable%beforeCursor%^%Variable%MMDFootnoteTag%
I need to look at it more. It may be that the second part of making an afterCursor variable is unnecessary and that making the beforeCursor variable, ⌘ down arrow and pasting ^%Variable%MMDFootnoteTag%: %Variable%MMDFootnoteText% then ⌘ up arrow and pasting %Variable%beforeCursor%^%Variable%MMDFootnoteTag% is faster.
I'll make both of them tonight. Clean them up, and test them.
Thanks for the input. I was just heading to lunch and had a similar idea. Basically select all and then do a nifty paste operation of the various bits of text before %|
, and after it, to make the footnote appear where it's supposed to be.
You're correct. KM currently does a lot of backspacing to make %|
work. Far from ideal and efficient.
Small update. I just did a quick test with an entirely new macro. It seems to be working and is rather fast.
Prompt for User Input ‘Footnote’
Comment ‘Pre Tag’
Type the ⇧⌘Up Arrow Keystroke
Type the ⌘C Keystroke
Set Variable ‘MMD__TEST Pre’ to Text ‘%CurrentClipboard%’
Type the Delete Keystroke
Comment ‘Post Tag’
Type the ⇧⌘Down Arrow Keystroke
Type the ⌘C Keystroke
Set Variable ‘MMD__TEST Post’ to Text ‘%CurrentClipboard%’
Type the Delete Keystroke
Comment ‘Insertion’
Insert Text ‘%Variable%MMD__TEST Post%…’ by Pasting
Type the ⌘Up Arrow Keystroke
Insert Text ‘%Variable%MMD__TEST Pre%[^%Variable%MMD__TEST Tag%…’ by Pasting
This might be faster (less saved variables steps):
Type the ⇧⌘Up Arrow Keystroke Type the ⌘X Keystroke Set Variable ‘MMDTemp’ to Text %CurrentClipboard% Type the ⌘Down Arrow Keystroke Comment ‘Paste footnote tag, end of document, and footnote’ Insert Text by Pasting
Type the ⌘Up Arrow Keystroke Insert Text by Pasting %Variable%MMDTemp%^%Variable%MMDFootnoteTag% Set Variable ‘MMDFootnoteTag’ to Text %Delete% Set Variable ‘MMDFootnoteText’ to Text %Delete% Set Variable ‘MMDTemp’ to Text %Delete% Delete Past Clipboard 0 Delete Past Clipboard 0
— Macro file:
— Full code: — <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
On Aug 19, 2014, at 7:52 AM, Zettt notifications@github.com wrote:
Small update. I just did a quick test with an entirely new macro. It seems to be working and is rather fast.
Prompt for User Input ‘Footnote’ Comment ‘Pre Tag’ Type the ⇧⌘Up Arrow Keystroke Type the ⌘C Keystroke Set Variable ‘MMDTEST Pre’ to Text ‘%CurrentClipboard%’ Type the Delete Keystroke Comment ‘Post Tag’ Type the ⇧⌘Down Arrow Keystroke Type the ⌘C Keystroke Set Variable ‘MMDTEST Post’ to Text ‘%CurrentClipboard%’ Type the Delete Keystroke Comment ‘Insertion’ Insert Text ‘%Variable%MMDTEST Post%…’ by Pasting Type the ⌘Up Arrow Keystroke Insert Text ‘%Variable%MMDTEST Pre%[^%Variable%MMD__TEST Tag%…’ by Pasting — Reply to this email directly or view it on GitHub.
Agreed. This saves some variables. Before I commit this change, I'll have to think of possible problems. Then, I guess, I can finally close this issue. Thanks a lot!
Fixed with 124e4159b01e4324131a986344e0e76fda41ab2b.
Based on issue #2.