Use script as custom printer driver to send file to web page At my workplace, I am unable to find a printer driver for macOS which works with the printer. Instead, I'm printing through the web-interface of the printer, and I'm wondering if there's a way to automize this.

The steps I do manually that I want to automize (all or some):


Save document as .ps (works better than .pdf for this printer)
Go to the web address and log in to the printer
Drag the file I want to the browser UI


Writing a script to simulate the web login and transmission of the file is a separate problem which I think I can solve. 

My question: Can I use this custom script (probably Pyhton) as a "printer driver" to make it show up in the list of printers and enable me to print using cmd-p? It would have to automatically save as .ps and then do the webb stuff.
You don't need to create a "driver" as the functionality you need is already available.  From the normal Print (CMD+P) dialog window, in the lower left corner, click on the PDF drop-down menu and choose the Save as PostScript option to save the "print" as a .ps file. (This part may have been your step #1 but I wasn't sure how you were saving the page as .ps)



Using a macro/script utility like Hazel, Keyboard Maestro, Automator, etc., they could be configured to monitor a specific folder where you save the .ps file.  When a new file appears, the macro/script could trigger to send the file to the printer.

Also, depending on the printer model, it is likely the script could send the .ps file directly to the printer using a port/interface designed for a script/stream instead of using the web GUI.  IPP/LPD/socket interfaces are designed for exactly this.  Most likely the web GUI is using a javascript to grab the file from you then pass it into one of these interfaces.

P.S. Notice that in the screenshot, the "Save as PDF" option has a CMD+S shortcut.  I created that by using the Keyboard Preference Pane in System Preferences.  If you want to do the same but for the "Save as PostScript" option... Open the Keyboard Preference, switch to Shortcuts, select App Shortcuts on the left then click the [+] icon below.  Set the shortcut for All Applications, Menu Title of "Save as PostScript...", and the Shortcut as CMD+S.  You can use CMD+S because the normal shortcut for CMD+S (File>Save) is not available when the Print dialog is shown.  Another good shortcut is CMD+P for the same reason.  That way you press CMD+P, wait a second for the dialog to appear, then press CMD+P again.