Ulysses - No Text in Clipboard

Any idea why this macro that I use to replace male with a female report does not work in Ulysses but works in TextEdit and other apps?

Upon pasting, I get "No Text in Clipboard" in Ulysses.

P.S. I added 0.5 seconds pause to avoid conflicting with Alfred app as my quick access to clipboard history is set to double press of the CMD button in Alfred.

Keyboard Maestro “Search and Replace Clipboard” Action

Convert Male to Femal Report.kmmacros (10 KB)

Can you upload the complete macro?

I just fixed my original post with the full macro.

OK, I reduced your macro to just one replace action (the one you originally posted), and it works fine with Ulysses 2.7.2 (32193), as well as with TextEdit :

Input: Mr. XX is selling bolts.
Output: Mr. Winthrop is selling bolts.

BTW: Since none of your replace actions contains a regular expression, you should select “String Matching” instead of “Regular Expression”, for example:


Click the Gear :gear: icon of any action to find a menu item “Help”. It takes you directly to the relevant article of the KM Wiki.

While it works with a sentence or a few paragraphs, it breaks when I use my text.

See if the macro will work with this text for you - https://pastebin.com/tEF8UL6V

Here is the updated macro:

Convert Male to Femal Report.kmmacros (10 KB)

OK, tried it now with your full text, and it gives me the same “No Text in Clipboard”. As you have stated, it works fine in TextEdit. I cut your text to the first third or so, and it worked again.

Reminds me of another recent problem with “No Text in Clipboard”.

What you can do: Try to find out if the issue depends on the length of the text, or on any special chars in the text, or on any other condition.

I am able to replicate the problem.

This text works fine - https://pastebin.com/wi1CDyH3 (2,743 characters)

This text creates an error - https://pastebin.com/TEYcgTEM (2,897 characters)

Edit: never mind. Larger text works as well. However, the above is still true.

Maybe I can somehow forward copied text to a Java script? I have this setup with TextExapnder.

// Start with the clipboard content
var result = TextExpander.pasteboardText;

// Replace XX to Last Name
result = result.replace(/XX/g, "%Variable%Last name?%");

// Replace DOB
result = result.replace(/DOB/g, "%Variable%Date of Birth%");

// Replace DOL
result = result.replace(/DOL/g, "%Variable%Date of Loss%");

// Replace double ..
result = result.replace(/\".."/g,". ");

// Replace duplicate words
result = result.replace(/\b(\w+)\s+\1\b /g, "$1 ");;

// Replace double spaces
result = result.replace(/  /g, " ");

// Replace Mr. to Ms.
result = result.replace(/Mr./g, "Ms.");

// Replace He to She
result = result.replace(/He /g, "She ");

// Replace he to she
result = result.replace(/ he /g, " she ");

// Replace His to Her
result = result.replace(/His /g, "Her ");

// Replace his to her
result = result.replace(/ his /g, " her ");

// Replace him to her
result = result.replace(/ him /g, " her ");

So, to cut the long story short: What is the culprit for the “No Text in Clipboard”?

In the text samples above, adding one more paragraph with one sentence breaks the Macro. On the other hand, the same Macro works with much longer text.

?

This is beyond me. The macro works and it works not?

Yes, KM supports JavaScript for Automation.

See here.

Sorry, wrong answer. Adding one more sentence as a new paragraph broke the macro to No Text in Clipboard

So, you are saying the issue happens when a certain amount of text (number of bytes) is exceeded?

From what I figured so far. Yes.

I’m not sure, but I tend to think that it really has to do somehow with KM.

Maybe KM’s Search action is limited to a certain amount of bytes? I never run into that problem, so I have no clue. Maybe @peternlewis can enlighten us.

Maybe worth to test a macro with copy/paste only (without search/replace)…

To answer my own question: this works fine in Ulysses

So the problem is with replacing clipboard content. There is some kind of limitation in KM? But then why does it work in TextEdit and other apps?

You are right, my thoughts are not really coherent. In macOS there are different clipboard types. The app choses in which format it copies data to the clipboard. Then, what KM can pick up is just what is on the clipboard. So, maybe there’s a glitch somewhere in-between.

But, I just checked it, after copying from Ulysses there is plaintext on the clipboard, as it should be. So, honestly, no idea.

What is the max number of chars/bytes?

Tom, while we are waiting for @peternlewis to look into this, can you please show me how would I pass clipboard content to a Javascript?

I did read the wiki, but I am too new to all of this to figure out how to connect clipboard to java with variables.

This is as far as I got:

Convert Male to Femal Report.kmmacros (5.4 KB)