Edit scripts / webview with external Editor

Hallo @Andreas_Hegenberg,

I was working a lot lately with Java / Apple Scripts and WebViews and was wondering whether it is somehow possible to have the code edited in an "editor of choice."

Currently, I select all + copy / paste code "to / from the editor," which is not very nice.

Maybe we could have a button "Open in Editor", which allows us to interface the code/HTML in some clever way. I'm not sure what would be the "best practice" here or the most flexible approach for such a "button":

  • Open the editor (defined in settings) via a temporary text file (with a fixed name).

  • Save the filename (see screen) in a string variable, which can be used to open the editor (within actions in a named trigger or so).

  • Save the code as a string in a variable - my WebView editor (CodeMirror) can get text/content from a fixed named BTT variable or a fixed named text file.

Thx,
Christian

you know you can already put the HTML/JS into any file on your machine and reference it in BTT?

For example:
localfile:///Users/someuser/Downloads/hello.html

It will auto-refresh the webview whenever the file changes

Ok, i did not use that one yet… it is similar to the use „external file“ in The jave script options.
Thx so far,
Christian

yep, just it can be used in webviews. you can also reference images,scripts etc. like this (<img src="localfile://..."/>

Alternatively you can use presetfile:// this allows to retrieve files from your preset'
s folder which are auomatically exported/imported if you export a preset

Yes, thanks!

I have now build two touchpad gestures, one to copy the script code to my FlipText var, then open the Webview editor (that uses that var), edit / save the code…then Go back to BTT and then i use the second touchpad gesture to replace the code in the Script textarea.

touchpad gestures will require that the mouse cursor is in the textarea…

That works on all script fields…