Howdy! What you want to do is fairly easy.
First, in your script you will want to define the current data table:
cd = Current Data Table();
Now, get the list of column names:
column_names = cd << Get Column Names;
Now, there are multiple ways to do the next part, but I find this to be the easiest. You'll want to start a text string that we will eventually parse and evaluate. The first part is to create a new window.
nw = "New Window(\"Graphs\",
randomname = V List Box(";
Now we can write the loop which will insert your custom code with one minor alteration. I'll assume you know how to use a JMP 'for' loop - I'm just going to iterate over all but the last column in the table.
for(i=1,i<=length(column_names)-1,i++,
nw = nw || "PUT YOUR CUSTOM CODE HERE*" || ",";
);
*In your custom code, where you define the dependent variable, remove it and replace it with
:Name(\"" || column_name || "\")
What this will do is paste in the text name of each dependent variable you have within the custom script you've written.
Finally, we need to finish the new window we started earlier: The first line finishes writing the code to make the new window, the second line first parses the text to make it code and then evaluates the code contained in nw.
nw = nw || "));";
eval(parse(nw));
That should do it - let me know if you have any questions or need specific help!