# Guide: Automatic Start via Drag/Drop

**URL:** <https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177>\
**Category:** Snapmaker 2.0 (3-in-1)\
**Tags:** Lightburn, Laser\
**Created:** [January 21, 2023, 5:23pm UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177 "2023-01-21T17:23:40Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Skreelink](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/skreelink/32/16398_2.png) [@Skreelink](https://forum.snapmaker.com/u/Skreelink)\
**Post date:** [January 21, 2023, 5:23pm UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177/1 "2023-01-21T17:23:40Z")

</div>

This is the “wireless” portion to round out my full Lightburn control guide, found here:

> [@Full Lightburn Control Guide](https://forum.snapmaker.com/t/full-lightburn-control-guide/27638):
>
> So… After a lot of testing… It’s been awhile since I’ve done a guide, and this one was a long time coming. This guide will allow you to do your entire project in Lightburn, and (if connected via USB) run it directly from Lightburn. Letting you skip Luban or using the USB drive entirely. A quick note, this guide, like most of mine, will assume you have some experience with the machine. As always, feel free to ask questions and I’ll try filling in any gaps you find. I’ll be posting the setup I …

Since my main snapmaker (pretty much stays setup with the 10W + Enclosure) is far away from my PC, using a cable + Lightburn isn’t an option. I usually just used Luban to start files. However, as many of you know, their software is slow and iffy, so why not bypass it?

Note: Be sure to read all the edits at the end of the post for more info.

There’s a few pre-requisites and I’m setting this up on a windows machine. However, it shouldn’t be too hard to format for a linux machine (mostly changing the bat into an sh and what that entails).

First and foremost; you **MUST** follow the full Lightburn guide. This method tells the machine to run the gcode file _as-is_, with no asking about material thickness, origin, etc. You have to have all that setup in the header section of your gcode.

Second, make sure you have `curl`, Windows 10/11 should have it built in, if not an installer can be found here: [curl for Windows](https://curl.se/windows/)  
Open a command prompt and just run `curl` and it should spit back `curl: try 'curl --help' for more information` if curl is installed.

Third; you will need to find your auth token, this is set when you connect Luban to the snapmaker (and tap the accept connection button on the touchscreen). The snapmaker saves one token and Luban remembers it for sending commands. So you will have to connect with Luban at least once.

To find this, the fastest way is to open a run box with `Windows key + R` and input `%appdata%\snapmaker-luban`, this will open the luban data folder. You will be looking for a file named `machine.json`, open this in any text editor and use the search function `ctrl-f` to find “token”. It will be the _second_ one you find, and will be in a “server” block. You will also need the IP address, which is conveniently right there too.

```auto
        "server": {
            "address": "xxx.xxx.xxx.xxx", < Copy the IP here as well.
            "token": "1c297775-3dcc-44d0-83f4-b9efad0c81d9", < THIS IS YOUR TOKEN
            "isAuto": false,
            "name": "snapmaker"
        },

```

After you have your IP and Token, make a new text file named something like “prepare\_print.bat”. I’ve also attached one you can edit to this post, unzip it, right click \> edit, and change the [IP HERE] and [TOKEN HERE] with your own. Remember to delete the brackets as well.  
[prepare\_print.zip](https://forum.snapmaker.com/uploads/short-url/sxlfxXTroI4X0nkRiIv9Nzwa5G6.zip) (335 Bytes)

```auto
@echo on
curl -X POST "http://[IP HERE]:8080/api/v1/connect?token=[TOKEN HERE]"
curl -X GET "http://[IP HERE]:8080/api/v1/status?token=[TOKEN HERE]&1674308796842"
curl -X POST -F file=@%~1 "http://[IP HERE]:8080/api/v1/prepare_print?token=[TOKEN HERE]&type=Laser"
curl -X POST "http://[IP HERE]:8080/api/v1/connect?token=[TOKEN HERE]"
curl -X GET "http://[IP HERE]:8080/api/v1/status?token=[TOKEN HERE]&1674308796842"
curl -X POST "http://[IP HERE]:8080/api/v1/start_print?token=[TOKEN HERE]"

```

After saving with your own IP/Token, you’re ready to go. In Lightburn just click `Save GCode` and drag & drop your saved `.nc` file onto `prepare_print.bat`. It will connect to the snapmaker, send the file to the controller, then tell it to start. There’s another connect and some status commands as well, just incase it times out after uploading the file, it reconnects to send the start print command.

EDIT: The touchscreen will show a disconnected from Luban message with a button called stop… Do **NOT** tap stop on the touchepad. The entire file is sent to the machine before it starts, even if you actually use Luban. It only shows status after starting, you can close Luban entirely and it’ll keep going. Never touch this button.

EDIT2: Speaking of, a fun fact you can do after starting a project is to connect Luban AFTER using the drag/drop. You can see a realtime location and a progress meter incase you wanted to see how much is left just as if you had started via Luban.

EDIT3: It seems with larger files (say \>15MB) it disconnects before completing the upload. This is because the snapmaker keeps the connection alive by receiving a status request every few seconds. ~~I don’t know what the ttl is for this, so the solution is to connect Luban and let it keep the connection, or do a status spam until it begins. I’ll see what I can do to mitigate this.~~

EDIT4: Nevermind, made a keep alive script and attached it below. Start the keep alive, then the project, once the project window disappears (and the project begins) Ctrl-C on the keep alive.

```auto
@echo on
curl -X POST "http://[IP HERE]:8080/api/v1/connect?token=[TOKEN HERE]"
:x
curl -X GET "http://[IP HERE]:8080/api/v1/status?token=[TOKEN HERE]&1674308796842"
echo Tap Ctrl+C to stop after the project begins.
timeout /t 2 /nobreak
goto x

```

[KeepAlive.zip](https://forum.snapmaker.com/uploads/short-url/72n8LE1JIfCVYtjopMLr1RT9DPK.zip) (304 Bytes)

---

<div class="post-metadata">

**Author:** ![Skreelink](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/skreelink/32/16398_2.png) [@Skreelink](https://forum.snapmaker.com/u/Skreelink)\
**Post date:** [January 22, 2023, 9:10pm UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177/2 "2023-01-22T21:10:36Z")

</div>

Another fun addon to this I found during my tests. You can actually recover the file you previously sent (given you haven’t ran another project since then). This even works _ **AFTER SHUTDOWN** _, the file stays wherever it’s loaded to and can be retrieved even after powercycling. So if you ran a project, deleted the file, but needed another for some reason, as long as you didn’t do any other things, you can get that file back.

```auto
@echo on
curl -X POST "http://[IP HERE]:8080/api/v1/connect?token=[TOKEN HERE]&1674308796842"
curl -X GET "http://[IP HERE]:8080/api/v1/print_file?token=[TOKEN HERE]" >> PulledFile.nc

```

[GetFile.zip](https://forum.snapmaker.com/uploads/short-url/eFWEwt7LKIMCNHhGnyhY56LcE5w.zip) (290 Bytes)

After putting in your IP/Token and saving, simply run it and it’ll dump a file named “PulledFile.nc”, which should be the last gcode thing you uploaded.

---

<div class="post-metadata">

**Author:** ![Skreelink](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/skreelink/32/16398_2.png) [@Skreelink](https://forum.snapmaker.com/u/Skreelink)\
**Post date:** [March 29, 2023, 10:22pm UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177/3 "2023-03-29T22:22:43Z")

</div>

Ha! Just got an XTool D1 Pro a couple days ago, and already had lightburn setup for it and was trying to come up with a way to use it without being tethered and the answer was right infront of me. I literally just used the same method for the snapmaker. 🙃 Using wireshark I got the POST URL and plunked it into a bat file. No need for the constant ping either.

```auto
@echo on
curl -X POST -F file=@%~1 "http://XXX.XXX.XXX.XXX:8080/cnc/data?filetype=1"
pause

```

Replace the XXX.XXX.XXX.XXX with your XTool D1 IP, save as a .bat, and just drag/drop your lightburn files onto it.  
While not a snapmaker, figured I’d share since it was a spinoff of this solution. 🙂

---

<div class="post-metadata">

**Author:** ![Skreelink](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/skreelink/32/16398_2.png) [@Skreelink](https://forum.snapmaker.com/u/Skreelink)\
**Post date:** [April 16, 2023, 3:29pm UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177/4 "2023-04-16T15:29:50Z")

</div>

A few more I made.

If you’re doing batch production and just want to keep repeating the same thing, you can simply send the start print code again via a bat file. I saved it as `RestartPrint.bat`

```auto
@echo off
curl -X POST "http://[IP HERE]:8080/api/v1/connect?token=[TOKEN HERE]"
curl -X POST "http://[IP HERE]:8080/api/v1/start_print?token=[TOKEN HERE]"

```

Same if you want to stop it if something goes wrong and you’re not close to the machine, named unironically `StopPrint.bat`

```auto
@echo off
curl -X POST "http://[IP HERE]:8080/api/v1/connect?token=[TOKEN HERE]"
curl -X POST "http://[IP HERE]:8080/api/v1/stop_print?token=[TOKEN HERE]"

```

A fun one, if you want to send lines of code yourself (basically the `console` in Luban). I named mine `SendCode.bat` It will continue to ask for the next command until you close the window.

```auto
@echo off
:a
set /p code=gcode to send:
curl -X POST "http://[IP HERE]:8080/api/v1/connect?token=[TOKEN HERE]"
curl -X POST "http://[IP HERE]:8080/api/v1/execute_code?token=[TOKEN HERE]&code=%code%"
goto :a

```

Keep in mind the letters in the gcode have to be capitals. i.e. `G28` and not `g28` and either send it with no spaces `G0Y100` or with underscores `G0_Y00`. This works with the snapmaker specific `MXXXX` codes as well, such as `M2000` for system inquiry. This is how the console in Luban works, anything you input is sent as a web API using the above URL. Just more on my endeavor to not use Luban at all. 🙃

---

<div class="post-metadata">

**Author:** ![macdylan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/macdylan/32/18460_2.png) [@macdylan](https://forum.snapmaker.com/u/macdylan)\
**Post date:** [April 18, 2023, 4:37am UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177/5 "2023-04-18T04:37:45Z")

</div>

Maybe you need this: [Release v1.5 · macdylan/sm2uploader · GitHub](https://github.com/macdylan/sm2uploader/releases/tag/v1.5)

$ sm2uploader model.nc slice.gcode  
$ sm2uploader -host CNC-350 model.nc

It allows you send files directly to any SM printers. FDBK is welcome 🙂

---

<div class="post-metadata">

**Author:** ![Skreelink](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/skreelink/32/16398_2.png) [@Skreelink](https://forum.snapmaker.com/u/Skreelink)\
**Post date:** [April 18, 2023, 7:36am UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177/6 "2023-04-18T07:36:46Z")

</div>

I’m a bit confused as to why you suggested I need this, in a thread that’s a guide. Though I appreciate the work that’s been done by any member of the community.

Personally, to me, the workflow of just dropping one file onto another, in which it automatically uploads and starts is a bit cleaner than using command line. It’s not fancy, and first setup is a little technical. But once you have the info you need, it’s quick and easy to use.

---

<div class="post-metadata">

**Author:** ![macdylan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/macdylan/32/18460_2.png) [@macdylan](https://forum.snapmaker.com/u/macdylan)\
**Post date:** [April 18, 2023, 7:41am UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177/7 "2023-04-18T07:41:46Z")

</div>

No offense, but I personally think this guide is complicated and needs to be filled with a lot of information precisely, any mistake will not work correctly.

---

<div class="post-metadata">

**Author:** ![Skreelink](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/skreelink/32/16398_2.png) [@Skreelink](https://forum.snapmaker.com/u/Skreelink)\
**Post date:** [April 18, 2023, 8:05am UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177/8 "2023-04-18T08:05:09Z")

</div>

To each his own 🙃. I find copying two lines once for a send and forget easier than having to memorize and type bash commands everytime.

---

<div class="post-metadata">

**Author:** ![Spark](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@Spark](https://forum.snapmaker.com/u/Spark)\
**Post date:** [June 22, 2023, 6:10pm UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177/9 "2023-06-22T18:10:33Z")

</div>

First off, these lightburn / wireless setup guides have been great. Iverson been able to follow them all the way up to the very last part! I’m having just one issue though.

When I run the Start\_print.bat I’ve made, it will show as connected on my Snapmaker, and disconnect shortly thereafter.

Running the KeepAlive and then running the Start\_print results in the SnapMaker machine eternally being connected to the computer, though it still doesn’t start the file. No movement or anything coming from the Snapmaker. The established connection will stay there until I Ctrl+C KeepAlive. Any idea what might be causing this or where I should look?

---

<div class="post-metadata">

**Author:** ![Skreelink](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/skreelink/32/16398_2.png) [@Skreelink](https://forum.snapmaker.com/u/Skreelink)\
**Post date:** [June 22, 2023, 6:59pm UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177/10 "2023-06-22T18:59:14Z")

</div>

A quick check would be to make sure to at least home the snapmaker from the touchscreen first. Then make sure there’s no spaces in the name of your laser gcode file.

Seeing the disconnect screen is normal, the file is uploaded to the controller so it will finish if it starts. Do NOT tap the stop button on the touchscreen. Also if it’s a particularly large file (say a raster image) it may take a minute to actually start as the machine processes the file.

---

<div class="post-metadata">

**Author:** ![Spark](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@Spark](https://forum.snapmaker.com/u/Spark)\
**Post date:** [June 22, 2023, 7:06pm UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177/11 "2023-06-22T19:06:33Z")

</div>

Okay, have not homed from the touchscreen. I’ll do that. Was reading through the threads and realized I may not have had the correct version of base firmware installed on my machine, as I just updated to the most recent official version by Snapmaker before installing the custom Firmware. Thanks for the quick response, having such a quick way to start laser files is going to be astounding!

---

<div class="post-metadata">

**Author:** ![Skreelink](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/skreelink/32/16398_2.png) [@Skreelink](https://forum.snapmaker.com/u/Skreelink)\
**Post date:** [June 22, 2023, 10:25pm UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177/12 "2023-06-22T22:25:17Z")

</div>

Hope the solution is simple. 🙂 I will say, being able to just toss something on the machine and walk away and drag/drop/forget is something you get spoiled to. 🙃

---

<div class="post-metadata">

**Author:** ![Spark](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@Spark](https://forum.snapmaker.com/u/Spark)\
**Post date:** [June 22, 2023, 10:39pm UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177/13 "2023-06-22T22:39:44Z")

</div>

Got that firmware flashed back on and homed, it works! Can drag drop with ease now! Couple bugs that I have to iron out.

I’ve noticed after completing a job, it is unable to drag/drop without me interacting with the machine. Opening Luban revealed that it had an unknown job going with no estimated time. Could not stop it from Luban. Walking to my machine revealed that it was just on the control screen, just where I had left it. Had to cycle machine power to get it to work again.

Gonna take a minute to get used to it, but this is great!

---

<div class="post-metadata">

**Author:** ![Madro](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@Madro](https://forum.snapmaker.com/u/Madro)\
**Post date:** [November 29, 2023, 8:58am UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177/14 "2023-11-29T08:58:34Z")

</div>

Hi guys,  
I got a problem with the sending via Wifi. When i create a gcode file and try to send it to my machine, the Z axis is in the wrong position.  
If i run that same gcode file through lightburn connected via USB it works just fine.  
Can anyone help me please.

---

<div class="post-metadata">

**Author:** ![Skreelink](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/skreelink/32/16398_2.png) [@Skreelink](https://forum.snapmaker.com/u/Skreelink)\
**Post date:** [November 29, 2023, 5:15pm UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177/15 "2023-11-29T17:15:04Z")

</div>

Make sure you’re using absolute coords for positioning, and that you’ve input the proper material height. Would you mind uploading the gcode file you’re trying to run?

---

<div class="post-metadata">

**Author:** ![Madro](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@Madro](https://forum.snapmaker.com/u/Madro)\
**Post date:** [November 30, 2023, 2:17pm UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177/16 "2023-11-30T14:17:52Z")

</div>

Thanks for the quick response.  
here is the gcode file.  
i can’t upload it, beacuse I’ a new user… so here is a link to it:

> **[Google Drive: Sign-in](https://accounts.google.com/v3/signin/identifier?continue=https%3A%2F%2Fdrive.google.com%2Ffile%2Fd%2F1BYONJlzrFTGj77QhXI2rPzbOfoTwajRw%2Fview%3Fusp%3Ddrive_link&followup=https%3A%2F%2Fdrive.google.com%2Ffile%2Fd%2F1BYONJlzrFTGj77QhXI2rPzbOfoTwajRw%2Fview%3Fusp%3Ddrive_link&ifkv=ASKXGp0iMY8ueIqcvkgZkvkVaOQlb8n-VlPZeijn375zamb1zNpkTvDN6TTwUzcZoN4xkiyr4B82dw&osid=1&passive=1209600&service=wise&flowName=GlifWebSignIn&flowEntry=ServiceLogin&dsh=S1260370526%3A1701353792420665&theme=glif)**
>
> Access Google Drive with a Google account (for personal use) or Google Workspace account (for business use).

---

<div class="post-metadata">

**Author:** ![Skreelink](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/skreelink/32/16398_2.png) [@Skreelink](https://forum.snapmaker.com/u/Skreelink)\
**Post date:** [November 30, 2023, 2:32pm UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177/17 "2023-11-30T14:32:13Z")

</div>

Upload it to something like zippyshare, or copy/paste onto pastebin please. Your link requires signin.

---

<div class="post-metadata">

**Author:** ![Madro](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@Madro](https://forum.snapmaker.com/u/Madro)\
**Post date:** [November 30, 2023, 2:52pm UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177/18 "2023-11-30T14:52:32Z")

</div>

Hope this works 😅

> **[; LightBurn 1.4.03; GRBL-M3 (1.1e or earlier) device profile, absolute coords...](https://pastebin.com/UwPenBWe)**
>
> Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

---

<div class="post-metadata">

**Author:** ![Skreelink](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/skreelink/32/16398_2.png) [@Skreelink](https://forum.snapmaker.com/u/Skreelink)\
**Post date:** [November 30, 2023, 4:25pm UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177/19 "2023-11-30T16:25:40Z")

</div>

Hm, everything looks right, focal length of 25mm and lasering something 4mm thick? You’re using the printfile code right? Where it auto-starts after it uploads?

EDIT: Also put a `G90` after the `M28` in the header, before the `G53`.

---

<div class="post-metadata">

**Author:** ![Madro](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@Madro](https://forum.snapmaker.com/u/Madro)\
**Post date:** [December 2, 2023, 9:05am UTC](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177/20 "2023-12-02T09:05:24Z")

</div>

Sorry for the delayed response.  
Yes exactly. focal length 25mm and material is 4mm thick. Yes I use your printfile. As said it starts just fine, but the Z height isn’t correct.

[Next page](https://forum.snapmaker.com/t/guide-automatic-start-via-drag-drop/29177.md?page=2)
