New Text Expansion From Selection [using KM8 features]

Glad that it works :slight_smile:

May I ask what is the purpose of opening/editing every macro immediately after creation?

Iā€™m asking because, if it is for example a specific setting/option you are missing in the prompt window, then it would probably be easier to add that option to the prompt, instead of setting it afterwards in the created macro each time.

Haha - mostly just a neurotic need on my end to validate that the macro actually worked.

Having it as a setting would be nice, but as-is, also works.

Thanks so much for your time Tom!

OK. So you will delete the 3 new lines of code in the near future, I guess :smile:

No, what I meant with ā€œsettingā€ was whether an important setting is missing in the prompt (when you create the expansion macro).

In the prompt, you can set the trigger, the case sensitivity, etc. But, for example, a thing you cannot set (in the current version of the macro) is the ā€œsimulate n deletesā€ setting. (I didnā€™t include that, because I think in 98% of the cases you would likely want to have that activated.).

And hence I thought the reason for your editing desire was some missing setting in the prompt (either the simulate deletes or some other other thing Iā€™m not aware). But every option that is available in the KM macro trigger of an expansion macro, can also be implemented in the prompt.

Well, if itā€™s only for neurotic reasons, then ā€¦ feel free to keep that neurosis up and running with the help of our modifications :relaxed: :slightly_smiling_face:

lol - sounds good!

What does sound good? (I just made some corrections/additions to my post above; maybe you missed them. Reload the page in that case.)

Hi Tom - I don't have anything else to add to your corrections/additions :grinning:

Everything "sounds good" , in other words :+1:

This macro is perfect for me with the new code you shared, thanks again for your time!

No prob. Glad that you are happy with the macro now!

PS:

I have seen I have a more recent version of the macro in my KM library, which I have labeled as ā€œbetaā€. (But still from 2018, it seems.) Trying to figure out what the improvements are (besides making some variables local).

Maybe Iā€™ll post that. Or, in any case, if you come across issues with the posted version, let me know, and I will give priority to a revised version.

1 Like

This is a great macro but I have also found the 'Invalid XML From AppleScript' problem. In my case, it appears to result from incompatible characters in the captured string.

To be specific, Ā£ and ā‚¬ both break the XML. E.g.:

Probably some other characters too, I just tested everything on my number row.

I've been using a snippet-making macro that doesn't rely on creating a new macro for each snippet, which gets around this problem. It looks to a .tsv database instead. However, the 'one macro per snippet' method also has its advantages.

Another thing I've found is that concluding each snippet-triggering macro with a 'Clear Typed String Buffer' action can make subsequent snippets trigger more reliably. That is the one main advantage that I've found Typinator to have over KM: it never fails to trigger, whereas KM occasionally does.