Anyone have experience using sketch to bring up what you’ve created via the linux command line?
I found this online, but it’s not working for me for some reason.
I downloaded the tgz processing file from the official site and then extracted it into my ~/ directory. From the processing IDE , if i open the sketch folder, it seems to be by default set to /tmp on my linux system, but using processing ide also creates a sketchbook folder in my home as well, but how exactly do I use the command line to execute sketch? can’t seem to get it to work
well, it should run, so might be that you type the command wrong?
how we could help if you not show the command / and the error you got.
like with a screenshot?
would have to be changed every time to reflect the new file i’m working on? since the new file name will need its own identical folder name?
is there no way to just have one folder for keeping all the files?
i’m using ./ because i haven’t set the those processing shell scripts as aliases in my .bashrc so globally, the system doesn’t know about these shell scripts (commands) yet. so ./ allows the system to know i’m trying to run this particular script in this folder.
If you want to have a bunch of sketches in the same folder and be able to run them, you could use a bash script for launching them. Lets assume we have these files and folders somewhere on our computer:
$ ls
data/
runp5.sh
test1.pde
test2.pde
The data folder can contain images, sounds etc needed by your sketches.
I have two working sketches (test1 and test2) and then my launcher script runp5.sh that looks like this:
#!/bin/bash
# The argument with .pde removed
base=${1%.pde}
# The folder where we will store the sketch
p5path="/tmp/$base"
# Remove the folder if it exists...
rm -rf $p5path
# ...and create it again
mkdir $p5path
# Symlink the data folder
ln -s "$(realpath data)" $p5path/data
# Symlink the pde file
ln -s "$(realpath $1)" $p5path/$1
# Run!
processing-java --sketch=$p5path --run
This script must be executable (you can do chmod +x runp5.sh)
Once things are set up like this, you can launch the sketches like this:
./runp5 test1.pde
./runp5 test2.pde
What does it do? basically it creates the required folder structure to run the sketch by using symbolic links, which is nice because they are tiny so it’s not copying any huge files you may have in data. Also nice because if you edit the files inside /tmp (say with the Processing IDE) changes are reflected in their original location.
But… it won’t work if your sketch uses multiple pde files, or in other cases I haven’t thought of.
If you are trying to script multiple sketches and don’t mind exporting them first, then here is a previous related discussion of writing a launcher script for multiple sketches.
The example launcher script is python, not bash, and it uses the self-contained app form rather than the raw sketch with processing-java.
You might also be interested in programs for managing multiple sketches, like the Processing Showcase: