Getting started with JavaScript macros in OpenBuilds Control

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.

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.

OpenBuilds CONTROL export macro
OpenBuilds CONTROL export macro

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

OpenBuilds CONTROL import macro
OpenBuilds CONTROL import macro

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

Tags:
0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*

©2024 Thayne Co

CONTACT ME

I'm not around right now. But you can send me an email and I'll get back to you, asap.

Sending

Log in with your credentials

Forgot your details?