I want to make a custom button that runs a javascript snipet and finally sends a gcode command to the printer. I tried javasript: self._printer.command("some_gcode_command") but that didn't work.
Is this even possible trough a custom control button?
So you have two options here actually. If you just do command then you can just send gcode directly. An example can be seen here. If you want to use JavaScript the function would have to call the OctoPrint JavaScript client functions. An example of that can be seen in my BLTouch plugin here. Basically it's OctoPrint.control.sendGcode('command to send');
That worked like an absolute charm! I was assuming that I could call 'self' as would be possible for a plugin but this would probably only work using the API. Thank you jneilliii!