How to automatically generate a png export from a .ndbx file in a command line (with a script)?

Gilbert Perrin's Avatar

Gilbert Perrin

01 Jul, 2013 10:03 AM

Hello,
I made a nodebox 3 file (.ndbx) that generates a dashboard of a production status.
It is based on csv files that change every day.
For the moment, I have to open each day the nodebox file manually and generate the png.
I would like to generate automatically the dashboard with a script that I could execute with our Continuous Integration System.
Is there a way to call nodebox3 in a command line with a .nbdx file and tell it to generate a png image?
Thank you!
Gilbert

  1. Support Staff 1 Posted by Frederik De Ble... on 30 Jun, 2014 08:20 PM

    Frederik De Bleser's Avatar

    Hi,

    I've added a GitHub Issue that tracks this.

    I've also solved it :-)

    The nodebox.jar now has a new class, nodebox.NodeBox, that serves as a command-line tool renderer.

    Since you don't only need the nodebox.jar but also all of its dependencies, you first need to find the full classpath. Use ant classpath for this:

    ant classpath
    ...
    classpath:
         [echo] /Users/USERNAME/.m2/repository/org/clojure/clojure/1.6.0/clojure-1.6.0.jar:...
    

    Copy the full classpath, and invoke it like this:

    java -cp CLASSPATH nodebox.NodeBox YOURFILE.ndbx
    

    Example:

    java -cp /Users/USERNAME/.m2/repository/org/clojure/clojure/1.6.0/clojure-1.6.0.jar:... nodebox.NodeBox ~/Desktop/colors.ndbx
    

    This will generate a file in the same folder with the PNG extension.

    There are two options:

    • -o FILE Allows you to override the output file
    • -l FILE Allows you to specify the location of the libraries folder, which contains the NodeBox system libraries. (By default we look in the current directory for a libraries folder)

    Hope this helps,

    F

  2. Support Staff 2 Posted by Frederik De Ble... on 30 Jun, 2014 10:21 PM

    Frederik De Bleser's Avatar

    The NodeBox JAR now contains all dependencies, so assuming you're in the root of the NodeBox Git repo, you can just do:

    java -jar dist/lib/nodebox.jar YOURFILE.ndbx
    

    You still need to refer to the system libraries folder.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

22 Feb, 2024 05:51 AM
22 Feb, 2024 01:11 AM
21 Feb, 2024 05:27 PM
21 Feb, 2024 04:49 PM
16 Feb, 2024 05:24 PM

 

06 Feb, 2024 04:45 AM
19 Jan, 2024 09:50 AM
13 Jan, 2024 03:47 AM
05 Jan, 2024 05:10 PM
05 Jan, 2024 04:54 PM
04 Jan, 2024 11:49 PM