We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › Scripting Processing using Java 6 JSR 223
Page Index Toggle Pages: 1
Scripting Processing using Java 6 JSR 223 (Read 761 times)
Scripting Processing using Java 6 JSR 223
Aug 20th, 2007, 5:47am
 
I quickly hacked up a PAppletScriptlet, that lets you send it javascript which it will then compile and use as your Processing applet (IE: setup(), draw(), mousePressed()).

Quick Overview:
http://eventhorizongames.com/wiki/doku.php?id=articles:processing:scripting:start

Example site (NEEDS Java 6, and only tested on Firefox, I'll clean it up later):
http://jddaniels.googlecode.com/svn/trunk/processing-scripting/dist/index.html

It's a quick and dirty hack right now, I'm still trying to find a way to "share" the containing PApplet's fields and methods with the script, so that I don't have to prepend every method call with a p.*, or having to use the with(p){...} javascript construct.

I think the best way would be to possibly port the Processing parsing stuff to be done on the fly, because the JSR 223 scripting spec. and scripting engine project, provides for ways to compile java code on the fly, so PDE code could be emitted as java code and compiled on the fly (although I don't know how we'd then inject that PApplet into the already running one with all it's context etc....)
Page Index Toggle Pages: 1