After updating from Safari 13 to Safari 14 (on macOS 10.15.6),
I have noticed that all of my text-filtering Automator workflows
no longer work correctly when invoked from the updated Safari.
For an example of such a workflow, see the screenshot below.
It shows a simple workflow that takes the current text selection,
pipes it through the fmt
command, and replaces the original
selection with that command’s output:
I have a few workflows of this construction, i.e., consisting of
a single Run Shell Script action running a command that takes
the text selection on its stdin and outputs the text to replace
the selection with on its stdout. I have been using them without
any issues for quite a long time (at least, for the last two major
releases of macOS).
However, when a workflow like that is run from the newly updated
Safari 14, it fails to replace the text selection with the output
of the workflow. Instead, it simply deletes the selected text.
The issue is clearly specific to Safari 14 only, because the same
workflows still work correctly (i.e., replace the selection with
the command’s output) in all other apps (e.g., TextEdit).
Is this caused by some security-related novelty in Safari 14 that
can be disabled, or is it simply a regression bug that has been
introduced in this update? Are there any known workarounds aside
from simulating copying and pasting for the command output in
Automator workflows?
Best Answer
I am not sure what exactly are you trying to accomplish, but I have an AppleScript code to replace characters and maybe it can be a good way for you to start. This solution works no matter the program because it uses GUI scripting, you just need to select the text and invoke the Service.
As you can see the code is changing all
:
for/
; you can use it to adapt for your needs.