Do TextExpander Snippet - Plugin Action

that’s ok. I only use console to debug some issues o it’s not frequent, but anyway. the plugin is really useful

1 Like

@ianthekirkland >> late to the party here - but thanks for this tool!

You asked for use-cases:

I have plenty of snippets surrounding specific phrases (in two languages) that I use frequently in emails.
They are to either respond to a request for a meeting, or to set up a new meeting, by using the Calendly service.

Thing is – I struggle to remember all my triggers, since there are about 8 of them in total.
I've now set-up a KM conflict palette, that only gets triggered in Outlook when using my Hyper+A key combination.
When triggered, up pops the conflict palette, whereafter I tap numbers 1-8, to select the snippet I want, which fires off the relevant snippet macro.
A bit convoluted, one might think – but really going to find this useful.

As it stands – going to roll this out across a couple of other snippet 'groups' as well!

So a belated thanks! Can confirm all appears to be working as it should on the latest TE 6.5.1

1 Like

Stupid question here, why do you need to use Keyboard Maestro to execute TextExpander snippet? Am I missing something here? Don't you just install TextExpander and off you go?

It's not a stupid question at all. I like managing my keybindings from a single application. Sometimes I trigger something and I wonder, "In which app/context did I set that hotkey/trigger?"

1 Like

If that's the came then I would love to know what other macros you've created? I can start:

  1. Morning and night setup macros - wakes Mac up and launches certain apps and URLs at certain times in the day.
  2. Plain text macro - doesn't work in Pages
  3. Macro for Photoshop - Basically shortcut for the stroke tool. Yes, I could give it a shortcut directly via PS but PS has so many keyboard shortcuts that it difficult to find an empty set of shortcut combinations.
  4. System info macro - A TextExpander snippet from a 3rd party.

Would love for someone to share how Macros are useful to them so that I get more out of Keyboard Maestro.

because my Keyboard Maestro is the basis to combine functions of different apps.
So also TextExpander @bocciaman

Here are a few older examples... until I would have created this only with Keyboard Maestro :wink:

Totally with you on the Photoshop thing. Hooking Adobe's keyboard shortcuts to something outside the Adobe environment is often a huge pain. Especially with apps like InDesign, where you get even more "contexts" in which a given keystroke will do certain things. The pros with Adobe apps is how much of their app DOMs they've exposed to Apple Events (e.g. AppleScript and ExtendScript). The cons are that if you can't conjure a decent solution, UI scripting is so horrendous, it's kinds of outta the picture.

Sometimes I'll set contorted keyboard shortcuts in Adobe that I'd never really use in real life because of how hand-stretching they are (e.g. CTRL + CMD + ALT + F5) and then map those to a "Type a Keystroke" macro in Keyboard Maestro.

I also, however, take advantage of things like "DefaultKeyBinding.dict".

You've touched on a topic I'm very passionate about and I will talk your head off for days about it. (I love nerding out on this stuff).

One system I've set up with Keyboard Maestro that I'm particularly proud of is the use of faux-modifier keys. It opens up a great deal of potential for more keystrokes and more specific contextual uses. For example, I have a macro that when I'm holding down [ALT + ;], temporarily enables certain other macros triggers until I release [ALT + ;]. This macro (see below) takes the text selection (or lack thereof) and wraps it with bookends (a 'pre' variable and a 'post' variable). What makes it special is that it's triggered by this key combination:

[ALT + ;] + [ALT + 2]

The reason for depicting the keystroke like this is because [ALT + 2] isn't enabled unless [ ; ] is down. And since [ALT] is already down, it's not necessary to include with the [ ; ]. It all sounds very convoluted, but is actually quite simple; If you've driven a manual/stick-shift automobile, it's a lot like a clutch.

Here's a handy example macro...which you can also use as a template:


DOWNLOAD KM MACRO: Text Wrapper - PHP Multiline Comment Selection - KMmacro.zip


ianthekirkland,

Thank you SO MUCH!

I downloaded as per your instructions and it is working fine so far with a couple of TE expansions in KM 9.0

This is exactly what I needed to put my KM macros into overdrive!

As you mentioned, now I can have a true source (TextExpander) for my text expansions but still have the option to call and use them from a Global Palette or even that new El Gato Stream Deck I am looking at.

again, thanks for all the hard work, it is much appreciated.

P.S.

Just realized I can do some amazing Terminal setups now and use my existing TE expansions that I normally type up by hand.

No more, hands are for losers, its all going to be automated in KM now.

HA!

That fact that you've found them useful totally made my day! Thanks for your feedback!!!

1 Like

You sold me on this idea. Can you please tell me how to execute TextExpander snippets through Keyboard Maestro?


Do TextExpander Snippet - Updated Plugin Action Set

by Ian Kirkland  |  Monday, September 2, 2019




Description

This pair of plugin actions are about as self-explanatory as they come; Both do the same thing (expand a TextExpander snippet) albeit in different ways. Do TextExpander Snippet expands by abbreviation, while Do TextExpander Snippet by Label expands by snippet label and group name, which is handy if you want to manage expansions via Keyboard Maestro (as a "single source of truth").

Both are plugin actions are useful for a number of reasons: triggering an expansion with a hotkey rather than a typed string (which you're limited to in TextExpander); managing system-wide triggers/keyboard shortcuts/etc. from a single interface (Keyboard Maestro); and more.

Who knows? You could probably create some interesting automations by pairing these actions with things like Keyboard Maestro’s conditionals and Macro Information tokens.




Do TextExpander Snippet (v 1.1) - UPDATED!

To use, simply enter the snippet’s abbreviation into the text field and this action will do the rest. It’s worth noting that this plugin action executes TextExpander snippets via scripting, not by crudely simulating key presses in the UI. This is an update to version 1.0, which can be downloaded here.

Changes in version 1.1:

  • Updated Icon

DOWNLOAD:  Do TextExpander Snippet v1.1.zip (101 KB)




Do TextExpander Snippet by Label (v 1.0) - NEW!

Enter the snippet’s group name and label and off you go! If you're wondering why the group name is necessary it's because we're triggering snippets by their labels, which don't need to be unique across groups. (e.g. If you had a snippet labeled "VueJS" in your "CND" group and a different "VueJS" snippet in your "HTML Includes" group, how would the TextExpander know which "VueJS" snippet to expand?)

DOWNLOAD:  Do TextExpander Snippet by Label v1.0.zip (102 KB)




Additional Notes

  • If you come up with any creative uses for the action, please share them here in the comments
  • Please report any bugs here or at: ianthekirkland@me.com



Installation

How to Install Keyboard Maestro Plugin Actions:
Keyboard Maestro has support for user written and contributable plug in actions. You can get more plug in actions from our web site or the forum and you can create and optionally contribute your own.

You can drop a new plug in action .zip archive on the Keyboard Maestro application dock icon to install it (note that to update a plug in action you must manually remove it from the ~/Library/Application Support/Keyboard Maestro/Keyboard Maestro Actions folder before re-installing it).
For more information, visit Installation of KM Plug In Actions



Legal

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 
 

If you've already installed the plugin(s) (SEE MY UPDATED PLUGINS ON THIS PAGE), you just need to do the following:

  • Create a new macro in Keyboard Maestro
  • Open the actions panel and add one of the following actions to your macro:
  • Assign your Keyboard Maestro a trigger if you haven't already done so
  • Fire away!

OK, I finally installed your Do TextExpander Snippet by Label action. When I tried it, I asked myself, "why are the extra steps of remembering the group name and label name needed?" If I wanted to add a TextExpander snippet to a Keyboard Maestro Macro, couldn't I just have Keyboard Maestro type my assigned abbreviation which I assume will trigger the TextExpander snippet if TextExpander is installed on my system?

Full disclosure: I am simply trying to understand because I would like to add more 3rd party actions plugins to my Keyboard Maestro. I actually want all my software to have actions available in Keyboard Maestro.

I'm using the TextExpander Plugin @bocciaman to reduce the abbreviations used to call the snippets. The same is true for calling macros or palettes. I use the gesture control of BetterTouchTool to avoid shortcuts.

With over hundreds of macros and snippets this is a relief for me and if a shortcut is necessary, I have a bigger choice :wink:

Here is an example of how I combine Keyboard Maestro and TextExpander to quickly assign my filenames:

2019_09_25_Support_1

The "Snippet by Label" is a very big help for me.

I've now tried both the "By label" and the "By abbreviation" plugin actions. I found that for me, I'd have to remember both the abbreviation and its trigger for Keyboard Maestro. That's a bit much for my taste. Although, I'm still keeping the action plugins, they may come in handy in the future.

This is good stuff! I'm definitely going to give these a try!

As already mentioned in my example, I don't need a shortcut, another abbreviation in Text Expander @bocciaman.
My Print Macro with integrate TextExpander actions is only called by a mouse click.

Hello @ianthekirkland, I use the plugin almost daily and it helps me a lot.

I just updated to TextExpander 6.8 and your snippet plugin doesn't work anymore. Will you update it?

Well, what definitely still works is expanding a snippet through a KM Applescript action:

tell application "TextExpander"
    expand abbreviation ";yep"
end tell

I have just tried it with TE 6.5 (as of today that's for me the highest version).