Sg2.9
Point collecting
Recent RSS
Point collecting
From:  Jim
Date:  7. January 2009, 18:42

Hi,

I want to write a script that allows me to collect the points that the user has generated -- i.e. all points generated by onMouseDrag().

I'd like to send this (perhaps large) collection to another application. Ideally, I'd be able to save them up and write them to a text file. Unfortunately, I don't think scriptographer supports writing to a text file... Am I wrong?

If I am, is there a good way to go about this? I tried dumping the points to the console, hoping to grab them after they get printed, but the console only retains a relatively small collection of past print events, which renders it useless for this task.

Anyone have other creative ideas on how to accomplish this?

Re: Point collecting
From:  John Simmons
Date:  7. January 2009, 18:56

You can indeed save the points to a text file, you can just venture into the java side (Rhino) - will find some source code that could show this...

Re: Point collecting
From:  John Simmons
Date:  7. January 2009, 19:03

Try this:

var writer = new java.io.FileWriter(new java.io.File("text.txt"));
writer.write("Text");
writer.close();

Out of interest what application do you want to send the information to, there are options: OSC, Sockets etc...

Re: Point collecting
From:  Jim
Date:  7. January 2009, 19:46

Ah!

I hadn't realized the bindings were this tight. Excellent.

I'm just sending the points to a custom openGL application that I'm working on. Functionality; TBD.

I hadn't initially considered sending the data directly over a socket. Now the wheels are turning again.

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Convert GPS .csv files to Illustrator paths 28.12.11