Transform & Copy Selection with Java Script not working

Hey there!

I'm relying on a copy&transform with JS shortcut regularly, but it has stopped working recently (I think once I updated to Sonoma). I know BTT 4.460 was supposed to fix something related to this, but it's still not working at all for me.

macOS version: 14.4.1 (23E224)
BTT Version: 4.479 (44790)

I've bound my custom action to option + cmd + c and it also gets triggered (well, at least I see the HUD overlay I assigned to the action for debugging). Testing the code of the action in the Action configuration window's "Example Input" section also works perfectly fine. But the clipboard doesn't change at all when I press the shortcut (the previous contents stay in there).

Note that this issue also reproduces for me if I create a new trigger with the default "Transform & Copy Selection with Java Script" action (upper casing strings) attached.

are you using it in standard apps or some remote desktop app? (I just tried again with the same shortcut, but it seems to transform fine here)

Remote desktop apps have become problematic with recent macOS updates though.

I'm mostly using it in VSCode, but it also doesn't work in Sublime Text, Chrome, or even TextEdit.

Ok in these it should definitely work.

Is there anything special about the keyboard layout you use? (BTT needs to use cmd+c to copy the text, then cmd+v to paste it after transformation, this can be tricky on custom keyboard layouts)

I'm using English U.S. on one machine and was using English ABC on another – it doesn't work on either.

Both are M1 Pro MacBooks. Tried it with the internal keyboard and an older Bluetooth Magic Keyboard.

weird. Is there maybe some other clipboard manager (or input event handling) tool running on these machines that could interfere?

None that I'm aware of... :thinking:

One thing to note:
I've now set up the default example for the Transform & copy with JS action to CMD + Option + B (to avoid accidental overlaps with CMD + C) and when I use this in Sublime it indeed shows in the bottom row "Copied 38 characters" (for example). So the copying part seems to work, but when I then try to paste, the clipboard does not contain the content it should (i.e., it still contains whatever I copied before or nothing).

Is there some sort of log that I could upload (or enable)?

BTT by default restores the previous clipboard contents 0.35 seconds after transformation & pasting.
Could you try running this terminal command to increase that restore delay? (BTT must be quit)

defaults write com.hegenberg.BetterTouchTool BTTPasteClipboardRestoreDelay 30

0.35s should be more than enough though unless for some reason the pasting is taking a long time

You could go to Help => Export Diagnostic Debug Information and send the result to me (andreas@folivora.ai), however I'm not sure whether the logs would contain much useful info on this

Ooohhhh – was that a recent-ish change for this action? The way I used it was just to copy something to the clipboard with a transformation so that I can paste it at any later time (and repeatedly). The action is titled "Transform and Copy" after all – I wasn't expecting to have to paste it immediately :thinking:

So yes, it seems to work if I copy and then manually paste immediately – but is there a way to disable that reset for an action that is intended to just copy modified text to the clipboard?

Ahh sorry, I thought you were using the transform & replace action for some reason.

Let me have a look at the transform & copy. Maybe that one has a bug!

Damn, indeed I accidentally added the clipboard restoration to that action while fixing the macOS 14.4 bug. This should now be resolved in 4.481 alpha (uploading now, will be available in ~5 min)

Thanks for reporting & testing!

Installed the update and I can confirm it works again on my systems as well. Thanks for the incredibly fast fix! :blush::tada::tada::tada:

1 Like