CopySelection copies the selected text to the clipboard.
ReplaceAllClipboard performs the first requested replace on the clipboard content.
Paste pastes the clipboard content thereby replacing the selected text.
At that stage it is too early to paste the transformed text back: only the first replace has been done.
The next CopySelection simply fails because there is no selected text anymore.
ReplaceAllClipboard performs the second requested replace on the clipboard content.
Paste pastes the clipboard content.
Hence 2 Paste commands will be produced and the result will not be what we expected.
The Solution: Use Consecutive "Replace All Clipboard" Commands
After understanding why two consecutive
ReplaceAll
commands fail to produce the expected result, the solution becomes clear.
Simply group the
ReplaceAllClipboard
commands between the
CopySelection
and
Paste
commands as follows: