# Macros

This section describes how to add a <mark style="color:red;">`START_PRINT`</mark> and <mark style="color:red;">`END_PRINT`</mark> macro in Klipper which will replace the gcode that is usually set in your Slicer software. I see moving the Start/End Print gcode from the Slicer to Klipper as an advantage, as you can update the gcode in your <mark style="color:red;">`printer.cfg`</mark> in Klipper directly, instead of having to open your Slicer, change the settings and then re-slicing the file you want to print.

{% hint style="info" %}
These steps are optional, you can leave Start/End gcode in your slicer and still be able to print a file successfully in Klipper.  If you will not be doing these Macros, you can continue to the [First Print](https://sean-dearing.gitbook.io/klipper-installation-for-anycubic-vyper/macros-and-slicer/making-prints) section.
{% endhint %}

{% file src="<https://3358793419-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEUZ4ecqSLgI2D4esAcVS%2Fuploads%2F75tKmCbfiEDb3gtzsYyI%2FStart_Print_and_End_Print.txt?alt=media&token=7e6ccfaf-70c7-4b21-a0ba-b0b8141f1dae>" %}
Start and End Print Macros
{% endfile %}

* Adding <mark style="color:red;">`[gcode_macro START_PRINT]`</mark> and <mark style="color:red;">`[gcodemacro END`</mark>*<mark style="color:red;">`_`</mark>*<mark style="color:red;">`PRINT]`</mark> to your <mark style="color:red;">`printer.cfg`</mark>;
* From the MainsailOS web interface, click <mark style="color:red;">`Machine`</mark>, then click on <mark style="color:red;">`printer.cfg`</mark>;

![Machine > printer.cfg](https://3358793419-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEUZ4ecqSLgI2D4esAcVS%2Fuploads%2FJ2LcRPBhap2n8BAcJ0MF%2Fbed5.png?alt=media\&token=966e71cb-934a-42ba-b0a1-3215c8c00fc3)

* Scroll down until you see the <mark style="color:red;">`[pause_resume]`</mark> section;
* Copy all of the text from the <mark style="color:red;">`Start_Print_and_End_Print.txt`</mark> file above and paste it just after the <mark style="color:red;">`[pause_resume]`</mark> section in the <mark style="color:red;">`printer.cfg`</mark> file;

{% hint style="info" %}
You can add this macro anywhere in the <mark style="color:red;">`printer.cfg`</mark> file, but to keep things clean I added it just above the existing macros already present in the <mark style="color:red;">`printer.cfg`</mark> file.
{% endhint %}

![Start and End Print Macros](https://3358793419-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEUZ4ecqSLgI2D4esAcVS%2Fuploads%2FlkWBU7SEZG3ASPPhLev2%2Fmac1.png?alt=media\&token=aabd7086-442a-46bf-a6f9-2004d84502e9)

* Click the <mark style="color:red;">`Save & Restart`</mark> button near the top right of the window;
  * This will save the <mark style="color:red;">`printer.cfg`</mark> file and and restart Klipper;
