It is. Did you see the regex solution I offered above?
A word to the wise – the best way to save your own time,
(and everybody else's)
is to skip past the LLM stage (approximate retrievals, fluency without understanding – industrialised BS),
and just come here with the problem that you want to solve.
You're right about that.
With AI, I'm venturing into areas where my inner bastard would hold me back.
As far as good solutions are concerned, ChatGPT is certainly not the first choice. On the other hand, I get involved in the “game” with AI because it lets me think outside the box.
It's a win-win with some compromises.
Perfekt ... Thanks
Bitte sehr.
Aber haben Sie das hier gesehen?
Even though you've already received excellent suggestions from Airy and Nige, I simply cannot resist a regex puzzle.
This expression
(?s).{0,140}(?:[^\S]|$)works even better than my previous regex to capture the 140-character text blocks as I understand the requirements to be.You can live test the regex here https://regex101.com/r/fZqLKI/1 if you'd like, but I've also attached the macro if you prefer. Alles Gute!
Eine einfache Möglichkeit, all dies zu klären, ist, Ihren Prozess manuell zu bearbeiten und Notizen zu machen, während Sie gehen. Richtig, dass, machen Sie alle Annahmen, die Sie gemacht haben, lassen Sie den Plan hier posten - und beobachten Sie, wie die Vorschläge einfließen!
Thank you very much for your answers.
I posted exactly that 2 hours ago. A plan that I had simply written down.
I had bought and installed KM shortly before. So I still have to mention that KM is completely new territory for me. It was only with the help(?) of the AI that I ventured so far into the depths of KM. So please understand if I can't implement all this so quickly. I have a lot of work to do. And at 61, it's also taking me a little longer ... despite my ambition and curiosity.
This expression
(?s).{0,140}(?:[^\S]|$)works even better than my previous regex to capture the 140-character text blocks as I understand the requirements to be.You can live test the regex here https://regex101.com/r/fZqLKI/1 if you'd like, but I've also attached the macro if you prefer. Alles Gute!
Perfectly solved with RegEx. Respect. Thank you very much.
Of course, this is completely useless because Message has no limit on message length.
When inserting text, message knows no limits. When sending, however, I get (at least here in Germany) an error message precisely because of this 140 character limit.
Edit:
Sorry if parts of my text sometimes appear in German, sometimes in English. I try to avoid this as much as possible.
I got a message from forum:
An error occurred: We appreciate your enthusiasm, keep it up! That said, for the safety of our community, you’ve reached the maximum number of replies a new user can create on their first day. Please wait 7 hours and you’ll be able to create more replies.
So I have to wait 7h ![]()
I posted exactly that 2 hours ago. A plan that I had simply written down.
That was the start of a plan, with many questions left unanswered.
You often don't need a complete, unambiguous, set of instructions when writing your own macro -- you know your own assumptions. But it does help when posting to the Forum because we only have what you post to go by -- a lot of people here are good at guessing at the missing information, but the more complete you are the less Q&A is needed.
So please understand if I can't implement all this so quickly.
No worries -- you've jumped in at the deep end with this macro!
At the moment you only have the text blocks being displayed -- you wanted the entire series of blocks on the System Clipboard. You also wanted the input to be from the System Clipboard. "For Each" can work on the Clipboard, and you can gather your outputted text then push that to the Clipboard at the end, ready for pasting.
Taking your plan literally, where each block is preceded by "Blocknn" on the line before:
Text in 140-Zeichen-Blöcke mit Regex v3.kmmacros (3.3 KB)
While the regex is tricky, everything else is simple KM actions and tokens. You can probably work out what's going on by looking things up in the Manual or by looking at the individual Wiki pages -- there's linked "Help" for many things in the Editor itself, try right-clicking and looking in the contextual menu.
If you get stuck and can't wait 7 hours (Oh, how I remember that first rush of enthusiasm!) you could try and send me a private message -- that might work.
When inserting text, message knows no limits. When sending, however, I get (at least here in Germany) an error message precisely because of this 140 character limit.
You won't get an error message if you use my macro because my macro splits your message into chunks no larger than your specified size. Did you try it?
Yesterday, you said you would test our solutions. Did you test them? Did they work?
I´m afraid ... no.
No Error.
Question:
- Where does KM get the text from (as content for the variable "LocalText")
- Where does KM get the number 140 as a limiter (for the variable "LocalLineLimit")?
You often don't need a complete, unambiguous, set of instructions when writing your own macro -- you know your own assumptions. But it does help when posting to the Forum because we only have what you post to go by -- a lot of people here are good at guessing at the missing information, but the more complete you are the less Q&A is needed.
Sorry, I don't have much practice writing in forums.
Of course, the more information, the clearer the problem becomes.
I hope my next posts are clearer and more detailed.
I think it's simply learning by doing.
While the regex is tricky, everything else is simple KM actions and tokens. You can probably work out what's going on by looking things up in the Manual or by looking at the individual Wiki pages -- there's linked "Help" for many things in the Editor itself, try right-clicking and looking in the contextual menu.
That is also my plan.
I'm afraid I've thrown myself in at the deep end with this project.
I'm going to shift down a gear, read through the tutorials and start with small steps.
- Where does KM get the text from (as content for the variable "LocalText")
- Where does KM get the number 140 as a limiter (for the variable "LocalLineLimit")?
The answer to your questions are that the macro I wrote for you is a "subroutine" (which is a macro that uses the subroutine trigger) which means you call it something like this:

You should read the documentation for subroutines:
https://wiki.keyboardmaestro.com/action/Execute_a_Subroutine
Have you ever used a programming language that supports subroutines? If not, I will provide examples.
To spare your contacts any unexpected heart attacks, consider splitting your messages at the last full sentence or paragraph before hitting the 140-character limit.
Otherwise, you might end up sending something like this:
Please help me!!! I don’t want to live anymore
And a little later:
now Lay’s has changed their crisps bags to cardboard boxes.
To spare your contacts any unexpected heart attacks, consider splitting your messages at the last full sentence or paragraph before hitting the 140-character limit.
Um Ihren Kontakten unerwartete Herzinfarkte zu ersparen, sollten Sie in Erwägung ziehen, Ihre Nachrichten beim letzten vollen Satz oder Absatz aufzuteilen, bevor Sie das Limit von 140 Zeichen erreichen.Otherwise, you might end up sending something like this:
Andernfalls könnten Sie am Ende etwas wie dieses senden:Please help me!!! I don’t want to live anymoreAnd a little later:
Und etwas später:now Lay’s has changed their crisps bags to cardboard boxes.
I've uploaded a dialog so that you can see what our exchange looks like.
A bit chaotic.
I could easily converse with you in English. But small talk is different to exchanging technical information. I would like to know exactly what you are writing to me. Otherwise it would be as if I were only listening with half an ear. And that would be a shame and waste the valuable time we give each other.
The people I talk to via SMS ( [S]hort [M]ssage[S] ) already know me very well and know that I will get in touch by other means if I intend to end my life. ![]()
But the hint has been received. Thank you very much.
In German, it's a bit more complicated: commas placed slightly differently can change the content of the sentence in exactly the other direction.
Example:
Version A
DE: Die Russen behaupten, die Amerikaner hätten den Krieg begonnen.
US: The Russians claim that the Americans started the war.
Version B
DE: Die Russen, behaupten die Amerikaner, hätten den Krieg begonnen.
US: The Russians, the Americans claim, started the war.
Now I will continue with the chapter: KM for runnaways.
I wish you all a nice and relaxing Sunday.


