Created
October 10, 2020 07:53
-
-
Save zvalentine22/c4162f0cda3c7a68e1281d521a2d6cb1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM Set Printer IP --------- | |
SET PRINTERIP="192.168.0.47" | |
REM ------------------------ | |
ECHO OFF | |
CLS | |
IF [%1] == [] GOTO :no_file | |
FOR /F tokens^=4^ delims^=^" %%a in ('C:\windows\System32\curl.exe -s -X ^"POST^" http://%PRINTERIP%:8080/api/v1/connect') DO (SET TOKEN=%%a) | |
ECHO Token is: %TOKEN% | |
PAUSE | |
:check_status | |
CLS | |
ECHO Click YES on printer screen to continue... | |
TIMEOUT /T 1 > nul | |
C:\windows\System32\curl.exe -s -w "%%{http_code}" http://%PRINTERIP%:8080/api/v1/status?token=%TOKEN% | FIND "200" | |
IF ERRORLEVEL 1 GOTO :check_status | |
CLS | |
ECHO Connected. | |
:upload_prompt | |
set /P c=Upload %1 [Y/N]? | |
if /I "%c%" EQU "Y" goto :upload | |
if /I "%c%" EQU "N" goto :quit | |
goto :choice | |
:upload | |
C:\windows\System32\curl.exe -s -X ^"POST^" -F file=@%1 http://%PRINTERIP%:8080/api/v1/upload?token=%TOKEN% | |
ECHO. | |
PAUSE | |
:quit | |
EXIT | |
:no_file | |
CLS | |
ECHO No file found. Next time drag and drop .gcode file onto %0 | |
PAUSE | |
EXIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment