Ability to run script from within KISS

Post Reply
sinned6915
Posts: 55
Joined: 28 Nov 2017, 10:06

Ability to run script from within KISS

Post by sinned6915 »

Jonathan et al-

I would like to request the ability to run a script from within KISS, specifically to upload to Octoprint.

This is how they do it from within S3D-
https://github.com/foosel/OctoPrint/wik ... -Octoprint

using CURL- https://curl.haxx.se/using command lines to send data.

best regards,

dennis
User avatar
pjr
Posts: 692
Joined: 05 May 2015, 10:27
Location: Kamnik, Slovenia

Re: Ability to run script from within KISS

Post by pjr »

Is it possible to use the Settings/Printer/Firmware/Post-Process entry field for this?
Image1.png
Image1.png (27.91 KiB) Viewed 2688 times
Peter
hacker
Posts: 149
Joined: 20 Aug 2016, 18:25

Re: Ability to run script from within KISS

Post by hacker »

pjr wrote:Is it possible to use the Settings/Printer/Firmware/Post-Process entry field for this?
Image1.png
Peter
It is. That's how I upload and print from kisslicer on the duet.
sinned6915
Posts: 55
Joined: 28 Nov 2017, 10:06

Re: Ability to run script from within KISS

Post by sinned6915 »

Thank you for showing me where this is.

How are you connecting and sending to the duet? What is the connection or protocol that you are using?
sinned6915
Posts: 55
Joined: 28 Nov 2017, 10:06

Re: Ability to run script from within KISS

Post by sinned6915 »

[quote="pjr"]Is it possible to use the Settings/Printer/Firmware/Post-Process entry field for this?

It IS possible! We should move this from Feature requests to Tips & Tricks! Here is my script using curl. I got some assistance in final debug from Jubaleth on freenode reprap irc.

Code: Select all

ECHO ON
ECHO FILENAME %1

curl -k -H "X-Api-Key: *YOUR_OCTOPRINT_API_HERE*" -F "select=false" -F "print=false" -F "file=@""%1""" "http://192.168.*.*/api/files/local"

PAUSE
KISS-CURL.PNG
Last edited by sinned6915 on 01 Feb 2019, 00:45, edited 1 time in total.
hacker
Posts: 149
Joined: 20 Aug 2016, 18:25

Re: Ability to run script from within KISS

Post by hacker »

sinned6915 wrote:Thank you for showing me where this is.

How are you connecting and sending to the duet? What is the connection or protocol that you are using?
The duet's protocol is described somewhere on the duet site or in the reprapfirmware's code, can't tell now, been a while, but it's basically

Code: Select all

curl --data-binary @"$inf" "${endpoint}rr_upload?name=$upf&time=$ft
where ft is file time:

Code: Select all

ft="$(TZ=UTC date -r "$inf" +%Y-%m-%dT%H:%M:%S)"
and potentially initiate printing:

Code: Select all

curl -s "${endpoint}rr_gcode?gcode=M32%20%22/${upf}%22"
Those are fragments of one shell script that is invoked with different parameters by applescript that presents dialog (like upload/print/nothing). Things are happening on mac, as you might have guessed. The recipe also applies to linux, not sure how exactly to deal with that on windows, but should be possible.
sinned6915
Posts: 55
Joined: 28 Nov 2017, 10:06

Re: Ability to run script from within KISS

Post by sinned6915 »

The syntax that works in KISS_2.0 seems to be -

YOUR_SCRIPT.BAT "<FILE>"

YOUR_SCRIPT.BAT contains-

Code: Select all

curl -k -H "X-Api-Key: **API_KEY**" -F "select=false" -F "print=false" -F file=@%1 "http://octoprint.local/api/files/local"
Post Reply