My original requirement for ChatGPT:
There is a text in the clipboard in macOS.
Lorem Ipsum serves as sample text. (attached below)
Permitted software: Keyboard Maestro
Permitted tools: regular Expressions (RegEx ... is already implemented in Keyboard Maestro)
Forbitten tools: Scripts e.g. Python, Bash
Forbitten: separation within words.
A macro is to be created with Keyboard Maestro that performs the following task:
Why the effort: the global SMS service only allows a maximum of 140 characters per message due to uniform standards.
Keyboard Maestro should therefore divide a long text into 140 character blocks so that the individual text blocks can be sent one after the other via SMS without any problems.
Using RegEx, it should be possible for KM to stay below 140 characters and to separate the text at the last possible space within the 140 characters. If the space is found, the text is copied from the first character up to this space and pasted into a separate variable. This text section is given the heading Block01. The variable is filled with further text blocks in the course of the runs. KM remembers the space from the first pass and starts counting 140 lines again from this space. RexEx checks whether there is a space at this position. If not, RegEx searches backwards again until it finds the next space. If the space from the second pass is found, the text between the first and second space is copied and pasted into the separate variable. The second section is now given the heading Block02
This continues until KM determines that the number of characters from the previous space to the end of the original text is <140 characters. The last part is entered into the separate variable at the end.
At the end, the separate variable is copied to the clipboard with all the text blocks it contains.
//—————
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.
Lorem
—————//