Hints for using bridgeCommand (or if anyone knows of any way to manipulate the clipboard in the editor with js)

Hi,

Does anyone know where to find pointers on how to use the bridgeCommand? I want to manipulate the clipboard in the editor and AFAIK the webengine won’t allow it through JS so it seems I have to do it from the python end. Basically I just want to run a regex (or two) on the clipboard before pasting when using a specific shortcut (ctrl+alt+v or whatever). The idea of the functionality is a flexible “paste without formating”, one could envisage a little more complex functionality like trying to find lists from bullet symbols etc. and creating HTML lists etc.

Cheers

maybe useful:

the anki developer damien/dae recently published a zip of all add-on code, the link is at PEP8 pylib by RumovZ · Pull Request #1443 · ankitects/anki · GitHub

1 Like

Thanks, I was wondering if it might be possible just to call bridgeCommand from JS to reach the Anki built-in functions to get the clipboard content, modify it in JS and then bridgeCommand back to Anki built-in paste function: net effect, the mod itself would only be JS, no need to install anything.

My python is crap, I was hoping for a quick dirty hack.