Page 1 of 1

Ability to run script from within KISS

Posted: 01 May 2018, 00:22
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

Re: Ability to run script from within KISS

Posted: 01 May 2018, 05:35
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 2690 times
Peter

Re: Ability to run script from within KISS

Posted: 02 May 2018, 11:07
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.

Re: Ability to run script from within KISS

Posted: 04 May 2018, 11:19
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?

Re: Ability to run script from within KISS

Posted: 08 May 2018, 02:44
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

Re: Ability to run script from within KISS

Posted: 08 May 2018, 15:49
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.

Re: Ability to run script from within KISS

Posted: 24 Jul 2018, 00:09
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"