Typinator 7 Update

Thank you @appleianer for going to that trouble for me. I will look at them carefully and the mail one looks as if it might be useful. I do have TextExpander on the old rate, 20$ a year which means it is not a big hit to keep it another year and see. Were I paying $40 I would be less inclined. I will let you know how it pans out for me and I really appreciate the trouble folk on this forum go to.

1 Like

I don't have many expansions so with that qualifier I will say that the main reason I went to KM instead was because the string triggers for expansions will show up on KeyCue so I can learn them or pull them up if I forget one very easily: so it is kind of ironic that it is another Ergonis product that pulled me off TextExpander rather than a direct choice in favor of their snippet app. It just works for me and I found the TE search for snippets that I could never remember clumsy and slow. KeyCue shows with two Command presses.

Oddly enough @appleianer today I timed on my iPhone, how long it took to set up a new Ulysses note through Shortcuts versus the new hard press on Ulysses' icon. The hard press method was far quicker by my timing. I do and have had shortcuts and workflows in the past which though 'neat' have been really slower than just doing it 'by hand' as it were. KM is one of the things that keeps me on OSX.

Love the post.

I've only been hearing great things about Typinator from veteran/power users.

I know this is an old post and Typinator is at version 9, but I couldn't find answers to the below questions. I was hoping and would appreciate if you could help me out with them so I commit to Typinator :slight_smile:

I have tried the trail version of Typinator but didn't find these features so asking.

  1. Can Typinator import snippets directly from Alfred? Alfred saves each snippet in JSON format.
  2. Can Typinator export snippets in a standard format, let's say JSON or something similar? In case I need to export out a few years later for whatever reason.
  3. Most importantly, I sync my Alfred snippets with iOS Text Replacement feature so I can use them on my mobile devices. How I do that is every time I have to add a snippet, I add that to Apple's Text Replacement and have a Python script query Apple's sqllite and create the JSON files in a specific directory in Alfred's preferences that Alfred auto-refreshes. Anything similar I can accomplish with Typinator?

Thanks :man_bowing:

1 Like

I have someone wanting to create Apple email templates that contain pictures, which Keyboard Maestro's mail template won't do.

Of the app here, would any allow/what would you recommend for creating Apple mail templates with pictures or any other path to creating and using Apple email templates?

I did find this > how to make a mail template - Apple Community, which suggests creating a mailbox for templates and dragging new or sent emails there and then using the send again command. This is workable and doesn't include placeholders for names and other filling info fields.

I'm trying TypeIt4Me and just let go of my subscription to TextExpander, which I may need to go back to for this particular usage.

Siri Shortcuts is one of the better options for automating emails in 2023.

1 Like

Let me start by apologising for reviving this old topic.
Because of it I ended up switching from TextExpander to Typinator.
My mind is blown. It is such a power tool compared.

Anyways, I am trying to get a grip on regex. Managed to do some things that I wanted but cannot do the following:
Auto capitalizing first letter after a new row or paragraph.

I got this set of text manipulation snippets - t t n r (new row) t t n p (new paragraph) t t l b (line break) and I would like to be able to auto capitalize the next case. Kind of one shot shift - or the built in auto capitalize sentence.

Any ideas on that?
Thanks

Both issues are addressed by options in my Text Toolbox:

You can adapt the code to your issues, of course.

1 Like

This is probably the best route for "rich" emails. You could try the old trick of adding your own placeholders, eg Dear «first_name», then macroing a series of Search and Replaces over those to get the personalised data in.

Another option would be to create the email bodies somewhere where the customisation is easier, like Text Edit or Word, then pasting into the new emails.

1 Like

Hey Vex, as a noob with regex I asked Gemini for the regex and how to configure it into a Keyboard Maestro macro and it produced what's below.

Selecting the text you want to capitalize and running this macro does the job.

Adapt to it Typinator (I don’t have Typinator to test with) and query Gemini or ChatGPT for fixes or enhancements.

I've found the LLMs to be helpful for these types of simple coding tasks and sometimes requires a few iterations to get it right.

Auto capitalizing first letter after a new row or paragraph. (1.1 KB)

Keyboard Maestro Export

Here's the Gemini explanations of the regex which might be useful:
*
regex ((?:^|\r?\n|\r)\s*)([a-z])
* Explanation of the regex:
* ((?:^|\r?\n|\r)\s*): This is the first capturing group.
* (?:^|\r?\n|\r): A non-capturing group that matches the beginning of the string (^) or a newline sequence (\r?\n or \r).
* \s*: Matches zero or more whitespace characters (spaces, tabs, etc.) that might appear after the beginning of the string or a newline.
* This entire first group captures the preceding context (start of string or newline) and any immediately following whitespace.
* ([a-z]): This is the second capturing group. It matches a single lowercase letter. This is the letter we want to capitalize.
* and replace with: Enter the replacement pattern in this field:
$1\u$2
* Explanation of the replacement:
* $1: This refers to the content captured by the first capturing group, which is the beginning of the string or newline plus any leading whitespace. This ensures that the preceding context and whitespace are preserved.
* \u: This is a special sequence in Keyboard Maestro's regex replacement that converts the next character to uppercase.
* $2: This refers to the content captured by the second capturing group, which is the lowercase letter.

Well, the nearest I can get using only Typinator is a regexp set to expand this
^([a-z])
to this
{/Uppercase $1}

Note that it's pretty disruptive if it's left enabled, you will probably still want to use Keyboard Maestro to enable/disable the Typinator set.

Another way to go might be to have a KBM macro to "fix it all" once you're done typing.

1 Like

@BernSh, thank you, that almost works.

I’m using ChatGPT Plus, which is great 75% of the time — but with this one it was running me in circles. I only turn to the forum when I hit a brick wall, and this was it.

Your regex is really close (it does capitalize new rows), but the issue is:
It also capitalizes whenever I move the cursor out of the text field and back in.

After digging into Typinators regex guide, I learned it does not support line-detection patterns like \n, \r, \R, or \v — at least not in live expansions.

So I stripped the pattern down to this for testing:
((?:^)\s*)([a-z])
Same problem — capitalizes on line breaks, but also when re-focusing the text field.

Their docs even say:

^ = beginning of a line — **irrelevant in Typinator, since patterns…
(meaning, Typinator doesn’t treat line boundaries like traditional engines)

That made me have a go with ā€œCombine with previous abbreviationā€ and ā€œCombine with following abbreviationā€ options.

Since I cannot get Typinator to recognise new line, I have tried this:

Combine with previous abbreviation:

  1. I created an abbreviation ttn that expands to ⇧↩ and #&Ā£:
  2. Then I created a regex rule combined with previous abbreviation with a trigger of #&\Ā£:r
  3. That was supposed to have expansion to remove #&Ā£: and capitalise next letter but me and GPT couldn't get the logic right

Combine with following abbreviation:

  1. I created a regex rule with abbreviation like this - \Q#&Ā£:\E([a-z])
  2. And expansion like this - {/Capital $1} - Failed again

I gave up on Typinator for text actions and decided to use a QMK leader key instead:

void leader_start_user(void) {}

void leader_end_user(void) {
  if (leader_sequence_two_keys(KC_N, KC_R)) {
    // Leader, n, r => Execute Shift+Enter, then enable One-Shot Shift
    tap_code16(S(KC_ENT));
    set_oneshot_mods(MOD_LSFT);
  }
}

So now I’ll use QMKs leader key for text actions, and use Keyboard Maestro for more complex stuff and assign it to leader key with shortcuts.

There probaby is a way to achieve this with regex within Typinator, but I give up.

It does appear that Typinator can run AppleScripts and include their result in an expansion. So if you do want to continue on the Typinator route you could maybe run an AppleScript that ran KM actions to munge the text, passing the result back to Typinator...

Not a user, so complete guesswork on my part!

1 Like

I apologize leaving you ending up thwarted.

I'm repeatedly surprised by how difficult it is to do seemingly simple things. It's real nice that we have the means to take a shot at it and that's lightyears from 20 years ago, but still.

I've found it takes at least seven iterations with ChatGPT to get moderately interesting Applescript code to work. While it was three days ago, May the 4th be with you.

1 Like

I'm just a noob is what it is, sure some people reading this find it trivial. :joy::man_shrugging:

For what it is worth I have found claude.ai to be better with AppleScript than ChatGPT. Gemini on the other hand seems to be next to worthless. It doesn't even follow things I tell it not to do. I'd say about 1 in 100 AppleScript I ask Gemini to help me with work but I keep trying thinking it might get better.

This is gold regex101 - Community Patterns.
Search field = Anything you can think of.

2 Likes

I'll give Claude a go, thanks!

Another great resource for Regular Expression Examples
Some Books about Regular Expressions
Great Regular Expression Tutorial - Learn How to Use Regular Expressions

Not sure if this was mentioned on the forum already, my quick search for it did not yield results. Leaving breadcrumbs for future regex enthusiasts.

Here is a Typinator regex to Remove leading and trailing whitespaces and sort all extra whitespace in between to single whitespace

{{CLEANSendStringVariable={/Regex /^\s+//\s+$//\s{2,}/ //{{SendStringVariable}}/}}}

2 Likes