javafx - How to send text from my text editor to a Processing-Sketch -
this question in reference earlier post (which put on hold). https://stackoverflow.com/questions/24091606/push-text-from-java-applet-to-processing-sketch
i have developed own text editor multiple text editing areas in javafx.
i allow user write multiple processing code/sketches, hit "run all" button run sketches in parallel.
i trying find way automate steps of :
for each text area in editor { -copy text -make new processing sketch -paste processing sketch created -run process sketch }
this not right approach it, if is, not sure how implement it. looked @ examples here on using robot. can java program "type" windows program notepad
but not seem work me.
any ideas on how achieve this?
i on windows 7, develop solution cross platform if possible.
your idea having editor gui interact processing gui is... messy. , unreliable. guis meant human interaction, not automatic interaction, , there's better way want.
the processing-java
program included in processing download can run command line compile , run processing sketches. processing sketch bit more source file, though-- should in folder structure metadata. automatic perspective, process goes like:
- have editor create folder called, example,
bubbles
inside sketchbook folder. - have editor create , fill text file called, in example,
bubbles.pde
. should in bubbles folder alongside file calledsketch.properties
contains information sketch. check sketches on computer contents. presumably you'd use filewriter, etc. compile , run newly created file. command like:
/path/to/processing-java --force --run --sketch=/path/to/sketchbook/bubbles --output=/path/to/working/folder/bubbles
--force
causes overwrite older versions of compiled bytecode
--run
causes compiled sketch executed after compilation
--sketch
specifies name of sketch compile. should path bubbles folder, not sketch itself
--output
specifies put compiled bytecodes. doesn't need anywhere in particular unless wish @ executables later. want keep track of how big working folder gets, compiling tons of sketches fill fast.
this shell command needs run. java app, you'd like
runtime.getruntime().exec(pjpath + "--force --run --sketch=" + bubblespath + " --output=" + outputpath);
i've left out details (the file writing/folder creation, etc) because that's specific app , can found elsewhere on internet. if you're on windows, you'll need adjust paths accordingly (backslashes, drive letters, etc) i've used linux conventions here.
Comments
Post a Comment