I commonly use the same find and replace for plain text. Is there a way to select text and hit a trigger in BTT to start up a simple find and replace in the selected text?
My specific situation has me converting html encoded URLs back to decoded URLs hundreds of times a day.
osascript -l JavaScript <<\EOF
var BetterTouchTool = Application('BetterTouchTool');
BetterTouchTool.includeStandardAdditions = true;
var result = BetterTouchTool.get_string_variable("selected_text");
result = result.replace("test", "replacement");
BetterTouchTool.setTheClipboardTo(result);
Instead of the replace, you can also use the JavaScript url decode/encode functions.
Thank you for your quick reply. I was not able to get this working. I did find this page from Apple, do you think this might hold the key to the answer?
I'm trying to do something similar, but I can't get this example to fully work either. The last step, sending the ⌘V , sends the PREVIOUS clipboard contents. I've tried adding in manual delays between various steps thinking it's a timing issue, but that doesn't help either.
If I remove the ⌘V step, then manually hit ⌘V after running the script, it does what I would expect.
I'm testing with exact same script/action as Andreas's example above.
I was trying to do the same thing. I found the following shell script to decode HTML which looks pretty simple, but don't know how to make it work with the selected text?
Has anyone ever figured out why the paste step used the PREVIOUS content and found a solution / workaround ? I believe I have a related issue with variables having prior content in them...