ChatGPT Webview x JS

Heavy user of chatGPT, and tried the shared preset, but not sure how to activate the webview... is the preset already packaged with a trigger to view it?

Apart from that, more interested in combining this preset/webview with the floating menu functionality to allow for applescript, javascript, shellscript injections into chatGPT... I think this would be a powerful feature and I'd like to put it together and share it with the community here... any thoughts or advice to this end would be appreciated.

I just needed something similar. There was an issue with the ChatGPT security policies, which previously prevented the BTT scripting from working on the chatgpt webview. With version 4.316 this should be resolved now.

Here is an example preset:
ChatGPT.bttpreset (23.2 KB)

Pressing cmd+r shows the ChatGPT floating menu
Pressing cmd+t executes a script on the webview, which gets the currently selected text, puts it into the prompt field and clicks the send button.

(async () => {

let selectedText = await get_string_variable({variable_name:'selected_text'})

let propmptTextArea = document.getElementById("prompt-textarea");
propmptTextArea.value = selectedText;

let fakeInputEvent = new Event('input', { bubbles: true});

let sendButton = document.querySelector('button.absolute');
setTimeout(() => {


You can use any scripting calls described here

1 Like

a kind of roadmap I put together for how this could grow... its a bunch of text so I paste it here:

just in case you haven't considered it: I think the OpenAI APIs are better suited for at least some of these things.

i did ask GPT itself what was more economical, their subscription service ('plus') or API calls... seems as though if there's going to be a lot of messages and crosstalk back-and-forth, the plus starts to win out, as the API costs start to climb.... but apart from that if you just mean in terms of flexibility for a use-case like this, yea im sure youre right...would be cool to still enable a more intelligent chatgpt via some or all of these features i listed tho... i havent started on this yet... if the api makes things significantly easier then i may just go in that direction...