Userscript copy paste content to another file

Hello, i am reading documentation of macro to create a a userscript i have few questions first :

Can i copy a selection from one file ( example file_1.html )
and paste the content of buffer in a second file ( file_2.txt ) with a userscript ?

You’d have to get a bit crafty, but it’s possible.

You can use the following to get a view for a given URI:


Or you can get all views and go over them manually:


Then you can make the view active with


After which you execute the paste command like you normally would:


Alternatively you could manually insert the text through manual processing with the ko/editor SDK:

var editor = require("ko/editor").editor(view.scintilla, view.scimoz);

Documentation for SDK:

The Console widget (bottom pane) is a great place to try out all of this stuff.

okay i will test this and read this doc.