OpenBuilds CONTROL’s default functionality is more than enough for most use cases, but what if you want to customize a menu item or have a need for your own wizard for a specific job setup? That’s where JavaScript macros come in.
Table of contents
Overview
OpenBuilds CONTROL macros come in two flavors; gcode and JavaScript. Gcode macros, as the name implies, are strictly for sending gcode to your controller. JavaScript macros on the other hand allow you to inject JavaScript functions into the app and even replace entire functions with custom code.
Adding JavaScript macros are added using the add macro functionality in the Macros tab. Simply add a new macro, give it a name, click on the JavaScript tab, add your code and save. It couldn’t be easier. The tricky part obviously is writing and debugging the code.
Debugging
Since CONTROL is a web-based app, press Ctrl + Shift + i to bring up the inspection panel. From there you can paste your JavaScript code directly into the console and look for any errors. I find this easier than editing the macro directly. Once I know my JavaScript is working as expected, I’ll create a macro for it.
I wont go into how to debug JavaScript here, but here are a few references. First, check out the Backend Devtools section of the CONTROL wiki: https://github.com/OpenBuilds/OpenBuilds-CONTROL/wiki/3.–Backend-Devtools
Also, Chrome DevTools has a built in debugger. You can learn more about that here: https://developers.google.com/web/tools/chrome-devtools/javascript
You can’t right click in the CONTROL app, so if you need to inspect a specific element, the easiest thing to do is open up a browser and go to:
http://localhost:3000
Importing and exporting macros
As of OpenBuilds CONTROL version 1.0.356, we can now import and export macros. Exporting a macro is a way to backup your macros or move them to another computer. Its as simple as right clicking on the macro and selecting export.

Importing a macro is just as easy. Click on the Import button and browse to the exported .json file.

Conclusion
Javascript macros are a powerful way to customize the OpenBuilds CONTROL UI and to optimize your workflow. If you need help or have an idea for a new macro, feel free to contact me.
If you are new to OpenBuilds CONTROL, be sure to check out my OpenBuilds CONTROL tutorial.
OpenBuilds Products I Use (affiliate):
OpenBuilds CONTROL
Workbee 1510 (similar to Lead 1010 or Lead 1515)
BlackBox Motion Controller
BlackBox X32 Motion Controller
Interface CNC Touch Controller
Router11
XYZ Touch Probe Plus