Simple text expansion in KM or Alfred?

One other thought with the KM macro: I have had the situation come up where I was editing a KM macro, and it simply did not execute as expected. When I created a new version of the macro from scratch and rewrote all the elements of it, it then worked. Somehow the first version got “wedged” and did not work, and I could not figure out why. This has happened to me a few times, so it might be worth a try for you.

That being said, I also use Alfred for my snippet expansions. In the cases where I need to do date calculations that are beyond what Alfred’s built in date calculation features can handle, my approach is to create a workflow using a snippet trigger. I can then attach a script in the language of my choice to generate the needed output.

For example, I frequently need a date string in the form of yyyy-mmdd where mmdd is the last day of the previous month (think bank statements). There may be a way to do that built in to Alfred but I could not figure it out (since the dd part is obviously dependent on the number of days in the previous month, taking into account leap years), so I just generated the proper date in a script instead.

You can do the same things in KM, but I remember reading somewhere a posting (I think attributed to KM’s author, but I could beg wrong) saying that KM works well for snippet expansion provided you “don’t have too many” with “too many” being unclear to me as an exact amount.

Either way, both utilities will do the job for you. As a general rule I decide between KM and Alfred based on whether the functionality of what I am doing is primarily based on a script I am writing (use Alfred) or more suited to the building blocks provided by KM (especially the macro palettes which I use extensively).

1 Like

What group is this macro in?
I recreated it and it worked when I put it in the global macro group.

1 Like

Double check that you have entered the text exactly right and haven’t left off a ‘%’ or something.
you might try the Keyboard Maestro forum. I tested it out and it works for me as you want it to.

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!

Paul

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.
image

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.

2 Likes

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.