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
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 icon of any action to find a menu item “Help”. It takes you directly to the relevant article of the KM Wiki.
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.
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 ");
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.
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)…
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.