Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0

Friday, 16 April 2010

Terse Code to use file chooser in Ruby Processing

Over on the processing discourse PhiLho the guru posted a short piece of code to get the app user to enter file path data into a sketch in vanilla processing. It can be incredibly terse in ruby:-

load_path = selectInput()# Opens file chooser
# If a file was selected, print path to file else print erro message
puts (load_path)? load_path : "No File Selected"
Update May 2014 this does not work with recent versions of processing (that rely on refelection crap).

No comments:

Post a Comment


Blog Archive

About Me

My photo
I have developed JRubyArt and propane new versions of ruby-processing for JRuby- and processing-3.2.2