Macros and userscripts code differences

I realize that the documentation for macros and userscripts is in flux, and efforts are being made to bring it up-to-date, but I still want to get up to speed as soon as possible. At this point, I have a short list of online resources that have been kindly pointed out to me by the ActiveState staff. I plan to publish it here, and find out if anyone has additional resources they know of. But before getting into that, I still have a couple basic questions, starting with:

What exactly are the similarities and differences between macros and userscripts, including the type of code that the JavaScript variety can contain? I have been told that macros were recently renamed to userscripts, which suggests to me that there would be no difference in the type of code they could use. And at, they sound roughly equivalent except macros are recorded, while userscripts are stored toolboxes, but the type of code is the same.

On the other hand, a recorded macro begins with:

if (komodo.view) { komodo.view.setFocus(); }

and sample macros I have seen contain code elements like:


While sample userscripts contain code elements that looks quite different, such as:

var editor = require( 'ko/editor' );
var file = require( 'ko/file' );
var view = require( 'ko/views' ).current();

Could someone please clarify what the code differences are between macros and userscripts, if anything? Thanks!

From my understanding, at their core, userscripts and macros are the same thing – they are commands Komodo should execute in sequential order. The real difference is in how they are created. Macros are initiated by the user, record keystrokes and actions, and convert those things into code. This is all done by Komodo with no user intervention except to start, stop, and save the result. On the other hand, userscripts are actually written by the user, and not by Komodo. I hope this helps.

Thanks for your reply. Yes, it is clear that the purpose of macros and userscripts are identical, and the way they are first created is different. But what I’m asking about is the differences in the type of code that I’m seeing in the example macros and userscripts – e.g. ko.views. vs require( 'ko/views' ). Is one of the two types deprecated? Are there advantages to using one type over another, e.g., more methods available?

It’s not deprecated yet, but the one with the require call is preferred. I can’t tell the difference atm (on vacation not at home) so you’re on your own. I’m sure the devs will help you.

Macros may generate code with deprecated constants, calls, etc. (They’re an older feature and could use some updating.) You’ll want to ensure your custom-written userscripts are using the published SDK (

Thanks for the info. What was mainly throwing me off balance was that I assumed the mechanism for creating a new macro would be using the canonical approach. But if that is not the recommended way, I will definitely keep that in mind and use the newer ko/* methods and properties.

For the record, macros and userscripts are identical. Userscripts is just a newer terminology we use as “macros” was not accurate and recognisable.

Thanks. Yes, that was my understanding. I was just mirroring the terminology of the procedure (or one of them) to create the macro/userscript: Tools > Macros > Create New Macro.