How to apply a TextSoap cleaner

Hi,
I have a "cleaner" defined in TextSoap. It operates five regex search-and-replace actions at once.
Then I can invoke that cleaner using a simple AppleScript:

tell application "TextSoap"
	cleanClipboard with "Apostrofa"
end tell

Note that I invoke "TextSoap" and not "TextSoap8", because that what's one does when using the Setapp version of the app.

My sequence of actions in KM is:

Type the ⌘C Keystroke
Pause for 0.2 Seconds
Execute AppleScript (and "save to system clipboard")
Pause for 0.2 Seconds
Delete Past Clipboard 0

TextSoap-KM

It doesn't work.
Please, what's missing?

Two quick suggestions for now:

  1. Try using the Copy action instead of "Type ⌘C" for the first action

  2. Don't delete the clipboard at the end; that's probably erasing the script's results

I think your problem is the delete past clipboard action.

If you're doing that before you do anything with the clipboard, then you'll never see the results of the AppleScript.

So remove the last command and the results of the AppleScript will be on the clipboard.

Do you need the delete past clipboard action? Are you trying to clean the clipboard history in some way? If not, then you could just delete that action.
If you want to revert the state of the clipboard to the way it was before you ran this macro, then you need to (1) do something with the text and only then (2) delete the most recent two items on the clipboard:
i. the most recent is the result of the AppleScript which gets copied to the System Clipboard in your Execute AppleScript action;
Ii. the one before that is the text that is copied in your first action when you type the Command-C keystroke)
You could do this by adding in a paste action after the second pause, then add a second delete past clipboard 0 action.

1 Like

Thanks to both of you.
I refactored my macro. Now it does anything. It doesn't even copy my text.

TS-KM

I changed the last action to "Insert System clipboard by pasting".
Now it deletes my text and the clipboard ends up empty.
So discouraging!

In the end I have created a palette with all the search-and-replace macros using the built-in regex action.
This works smoothly.