I have a fairly simple task I’m trying to automate:
1) copy <text> 2) Find every occurrence in the document of a fixed, reasonably straightforward regex and replace it with <text>.
The point is that I always know where to find <text>, but I don’t know what it says. Doing this by hand is obviously pretty simple, in fact there are two neat ways:
(a) shift-cmd-E on <text> then replaceAll. (b) cmd-C on <text>, then findAll, then cmd-V.
I can’t get either of these to work in a macro.
(a) Seems to fail because the argument to findWithOptions: requires a replaceString. What the macro does is set replaceString equal to whatever value it received (i.e <text>) when the macro was recorded . Removing the line in the macro setting replaceString produces an empty set symbol, which is understandable. (b) Seems to fail because macros don’t like findAll. When I record this operation alone and replay it, all it does is put the caret at the end of the document (the location may be specific to the limited test I’ve done, but the point is I don’t get the multiple carets I should.)
Is there a way of automating this task using macros. I’d much rather not dive into scripting. For example, is there some way to set replaceString equal to the contents of the clipboard?
It doesn’t seem like this should be difficult.
Regards R.