Simple text expansion in KM or Alfred?

You may have a non visible character in your trigger. Try a different trigger and see if the expansion fires.

1 Like

Worth a try, however he does have the automatic ‘5 deletes’ which matches the five visible characters, that hadn’t occured to me. @pkondo check that other dates are working in macros. At the worst there could be an issue at the source of where Keyboard Maestro draws the raw date time information. Date tokens in Keyboard Maestro are drawn from the Apple preferences date time formattings.

Wow, I really thank you all for trying to figure out my issue. I tried all the suggestions but to no avail. But then I did something super basic. I created a simple macro just to type ‘hi’ when I select the macro from the menu bar.

I then opened up a new Apple Notes doc and select the macro. Nothing happens. So something odd is happening.

I checked I was running the latest version of KM. I then just decided to shut off my laptop completely and try funning the macro from the menu bar. I did it while I was in an Apple Note and in Apple Mail. No luck.

I have attached the super simple macro here.

This is one of the main uses I get out of Keyboard Maestro and I have never had quite your problem.

Try Keyboard Maestro forum. You do have other macros that work OK? and all your permissions are correct?
Keyboard Maestro is quite sandboxed unless you give the permissions. If your other macros are working though I can’t think of anything more. You did the usual restart and so on?

Yeah John, the problem seems to be elsewhere. There is, I believe, often good reason to do it your way. I paste some snippets and put a ‘delete past keyboard’ action in to stop it cluttering my clipboard. That makes the snippet function on Keyboard Maestro pretty much as good as TE. I don’t have many, by many some mean hundreds and some have also dozens of macros. I have only about 60 macros, that is all I need but I could not manage withouth them!! I am told that large numbers of macros entail some strategic thinking to save space and RAM. It isn’t something I have to deal with. Out of interest how many macros do you have?

OK @pkondo I found this by the excellent @JMichaelTX on Keyboard Maestro Discourse.

Thanks so much for digging. I was actually in the middle of writing this but then got interrupted.

I’ve got a lot of crud on this computer but this is in prep for getting a new laptop, possibly by the end of the week. This current laptop is 7 years old and has tons of apps on it, many I don’t use.

When I get the new machine, I’m going to keep my apps minimized until I know I need them. This is actually the reason why I asked this question in the first place because I was wondering if I could get rid of Text Expander since I knew I would install KM and Alfred. This was the last snippet I was needing it for.

I’ll post back once I get my new laptop and hopefully, all this goes away.

But again, everyone here is always so generous. So thanks again for all your time and effort!


1 Like

It would be really interesting for me, us I guess, to hear how it works out, make sure you let us know. I will say that I intend to apply exactly your strategy. I am already there really. I get TE on the old rate sub as I already had it, 20 bucks a year, I wouldn’t pay more and am not sure anyway I need it. I have found that I can manage perfectly well with just Keyboard Maestro. I will say that I have a relatively small number of macros, total including snippets is unlikely to get much over 100. I rely on them totally though. Really interesting exchange, thanks Paul.

As basic as my macro is, I didn’t realize that I could do that in KM or Alfred. I don’t use Alfred except as an app launcher but I had the Powerpack.

Yesterday, I found out that I had v2 Powerpack but I was running Alfred v3.

I downloaded v4 and now will purchase the Powerpack. I listened to two recent MPU eps that talked about Launchbar and Alfred and I want to improve my workflows and I think there are some really basic things I could use it for to make my life easier.

I have KM and had gotten the Karabiner app but never got that to work properly to map my Caps Lock key. I’m hoping that also works when I get a new laptop.

1 Like

ahhh, I think your work horse did 7 years of fairly hard service, that is really the problem here I think?

I use Karabiner just for the Caps lock trick. It is really useful you will love it, again that should work ok and it doesn’t for you. As long as one is careful with permissions.

I wish somebody would pile in really and say why, for a small number of snippets TE is more useful? Even for larger numbers of macros there are strategies to save RAM and plist space. TE is a nice app and I do like it I will say. I just like Keyboard Maestro more. Or somebody would come in with a kind of limit for Keyboard Maestro. Like what is the sensible number of snippets over which one should use TE? I have no idea of the answer and haven’t the capacity to experiment. @MacExpert any views? @MacSparky what is the limit on the number of snippets one can have on Keyboard Maestro before one needs TE? See I rely on a small number of macros and snippets, but without them, this would be a different machine.

I always use Insert text by typing, as I’ve had some issues (don’t recall what) with pasting text. The side effect is the clipboard is not replaced.

I have 299 macros.

  • 102 are words that appear in a palette for use as keywords in my reference manager and DEVONthink (to avoid spelling errors, duplications, etc.)
  • 50 are special characters like :g: is 𝛾 (gamma), etc.
  • the same 50 also have a LaTeX equivalent, so typing :g: is \textgamma{} when that palette is active.
  • A half dozen for different date formats.
    • ddth=Dec 4, 2019 12:33 PM (date date time human readable)
    • ddh = 2019-12-04 (date date human readable)
    • ddt = 20191204123451 (date date time)
    • etc.

Then I have several that use the hyper key (CapsLock remapped using Karabiner-Elements) to trigger different things, Hyper-P toggles my VPN, Hyper-T opens a Terminal window at the current Finder folder, etc. CapsLock by itself (just tapped) opens Alfred.

1 Like

Interesting. I hope other pitch in. I used to use ‘type’ but I went back to pasts and put a ‘delete past clipboard’ action to stop clutter. Again since I have a small number the extra action is irrelevant to me when setting them up and I keep that in ‘favorites’. I like to use ‘type’ if I can, even for longish ones, just to watch it happen.

1 Like

I have twenty snippetts and 105 macros in total. Without them I would be totally lost. I have about 20 in that must have category. If I remember right you use LaTeX ? is that true. Do you use any snippets for that. I don’t I tend to use templates I save as I use my own formats mostly now and very little formulae and that kind of thing. I love LaTeX though and use it almost for old times sake. I still think it produces a good looking pdf though. An impressive one.

I wanted to give all the kind people here some closure.

I got my new laptop yesterday and spent a bunch of hours setting it up. (I’ll spare you the details of getting a bad laptop which I had to return.)

It’s amazing how many pieces of software I loaded because I rely on them on a daily basis.

Anyway, I made the KM macro that started this whole thread and it worked perfectly. So there must’ve been some sort of conflict preventing it from working on my old laptop.

So thanks again for all the help.

But as I was going through this thread again, I wondered if KM or Alfred would be the better choice, if one had both installed. But unless I don’t know how Alfred snippets work, wouldn’t one have to invoke Alfred first and then run the snippet?

1 Like

Come on Apple/Foxconn. Do better.

Alfred snippets work without invoking Alfred first. I have a library of Apple symbols in Alfred for things like the command key, option key, etc. symbols. The library is in Alfred because someone made it available and I could import it, rather than creating by hand.

Glad you got things working. When all else fails, replace the computer :slight_smile:

1 Like

Good to know about Alfred snippets working without invoking Alfred first. Thanks.

I haven’t had the Powerpack for probably a couple of years (without my knowledge) so I’ve been debating on whether I should get it since clearly, I may not need it. But with a new laptop, I’m being very conscious (and proactive) about finding good workflows.

I think I’m going to take a long look at KM to see where that can take me first.


I have Launchbar which is similar to Alfred I believe. It is a wonderful app and I will continue to use it. I could manage just with Keyboard Maestro now though for sure. I like to have both really.

I recently listened to MPU ep 497 and also the follow up about Alfred. I never looked at Launchbar until the other day albeit very quickly. I figured there was very little need since I had Alfred. But the question became whether I should take a look at Launchbar. I don’t like switching apps to the latest and greatest.

One thing that I know I want to learn and utilize is a clipboard manager. I don’t know why I’ve never dug into one.

Yeah. I only have Launchbar, that was the one I started with. I have been tempted to try Alfred, folk say good things about it. Actually I am spoilt for choice. Launchbar’s clipboard manager is excellent and I use it. I also though use the clipboard on Keyboard Maestro, which is, for my uses anyway, slightly better and has a larger capacity and you can ‘fix’ favorites. It is really worth exploiring. That is one reason I could manage now just with Keyboard Maestro. I only found the clipboard recently too. These powerful apps have resources you only discover after months or years.

If anyone is considering migrating to Keyboard Maestro for text expansion, I post below an AppleScript that I threw together to rapidly create KM macros for this purpose.

At the top a variable named snippets is set to a list of the snippets to create. For each line, set sName to the name to be given to the macro; set sString to the string to be inserted when the macro is run (the macros are created using the insert by pasting [faster than insert by typing] and auto delete the trigger characters); set sTrigger to the snippet trigger. You can add as many lines to snippets as yo like.

Below that, set targetMacroGroupName to the name of the macro group to put all of these snippets into. If this group does not exist, it will be created.

I like the idea from @JohnAtl to have a pop up palette with triggers in it, so you can set paletteMacroGroupName to the name of a macro group used for the pop up palette. Again, this does not exist it will be created. HOWEVER, you will need to manually edit the created group to set it up as a palette and format the palette’s appearance. [There is some commented xml to do this (and set it up with the theme I want for the snippets palettes, but I haven’t testing that part yet, so it is commented out for now. Feel free to test and let me know what corrections are needed.] If you want to populate these snippets into the palette, also set makePaletteEntry to true; if false then no palette population will be made. Also, the palette group won’t get automatically created if this is false.

If you want to prefix all the created macros with a string, set it as macroNamePrefix. If you want all of the triggers to have a prefix (here I use “;;”) set that as macroTriggerPrefix. Note that you should NOT include the prefix in the macro trigger in the snippets variable. if it is specified here.

Hope this proves useful to someone. Happy to make (limited) modifications if anyone has any ideas to enhance this script.

set snippets to {¬
	{sName:"", sString:"", sTrigger:""} ¬

set targetMacroGroupName to "Snippets: General"
set paletteMacroGroupName to "Snippets Palette"
set macroNamePrefix to "General: "
set macroTriggerPrefix to ";;"

set makePaletteEntry to true

tell application "Keyboard Maestro"
	set mgs to every macro group
	repeat with mg in mgs
		if the name of mg is targetMacroGroupName then
			set targetMG to mg
		end if
		if the name of mg is paletteMacroGroupName then
			set paletteMG to mg
		end if
	end repeat
	if targetMG is equal to missing value then
		set targetMG to make new macro group with properties {name:targetMacroGroupName}
	end if
	if makePaletteEntry is true and paletteMG is equal to missing value then
		set paletteMG to make new macro group with properties {name:paletteMacroGroupName}
	end if
	repeat with snip in snippets
		set {sName, sString, sTrigger} to {snip's sName, snip's sString, snip's sTrigger}
		tell targetMG
			set m to make new macro with properties {name:macroNamePrefix & sName}
			tell m to make new trigger with properties {xml:"<dict>
						<string>" & macroTriggerPrefix & sTrigger & "</string>
			tell m to make new action with properties {xml:"<dict>
						<string>" & sString & "</string>
		end tell
		if makePaletteEntry then
			tell paletteMG
				set p to make new macro with properties {name:macroNamePrefix & sName}
				--tell p to make new trigger with properties {xml:"<dict>"}
				tell p to make new action with properties {xml:"<dict>
						<string>" & m's id & "</string>
			end tell
		end if
	end repeat
end tell