Paste Nth element from clipboard not working until clipboard manager is shown at least once

Hey, it's a bug that's present for a while and is present in the latest up-to-date version of btt - even though minor one, I thought that it's worth reporting :slight_smile:

Steps to reproduce:

  • Restart BTT

  • Try to use Paste Items action

  • Note that nothing is happening

  • Restart BTT once again

  • Use an action that will show clipboard manager

  • Try to use Paste Items action

  • Action now works

Also I'd have a feature request for clipboard manager - I can later move it to separate thread if necessary.
Application called Clipy provides a clipboard manager similar to this of BTT - but, BTT lacks something that Clippy does have - custom formatter. In clippy, you can define your own function written in JavaScript that will do some stuff on the copied contents and just then return it.

This could be used similarly, meaning:

  • BTT User defines an action "paste from clipboard"
  • Adds a custom function by some UI created for it
function parse(text) {
  return text.replace(/Clipy/g, 'BetterTouchTool');
}
  • User copies text Clipy has custom parser
  • User pastes using defined action and sees BetterTouchTool has custom parser

I know that perhaps adding JS like interpreter to it may be tricky, but really any way to custom-parse text before pasting would be awesome :slight_smile:

Cheers!

The JS integration has long been on my TODO list and should be relatively simple. I could either make use of JavaScript for Automation Apple Scripts, or integrate the Apple JavaScriptCore interpreter (most of the work would probably be UI). I also need that for other things, so this will definitely be added.

I'll look into the bug!

1 Like

thanks for great support once again!

It's great to hear that. I'm not sure how Apple JavaScriptCore intepreter works, but can tell from experience with working with JXA that it has some quirks and is not 1:1, same-syntax fully working JS (and does not include lots of keywords from newer versions of EcmaScript). I'm not sure if JavaScriptCore is something that's used under the hood of JXA or is something different, but wanted to note that. Still should be more than enough for this simple purpose of parsing text. Best!

JavaScriptCore should use the same engine as Safari, which is much more powerful than JXA. (However JXA would be easier to integrate, I'll do some tests whether that would be enough for basic text manipulation)

1 Like