I can answer a few of your questions:
1. You need to clear any selections made in your table. You can do this via:
dt << clear select;
where dt points to your data table
3. After creating your graph, add a filter by clicking on the little red triangle > Script > Local Data Filter. Then add one or more variables as a filter column. Now click the little red triangle next to Graph Builder and select Copy Script. Here's an example:
dt = open("$sample_data\Big Class.jmp");
Graph Builder(
Size( 526, 451 ),
Show Control Panel( 0 ),
Variables( X( :weight ), Y( :height ) ),
Elements( Points( X, Y, Legend( 12 ) ), Smoother( X, Y, Legend( 13 ) ) ),
Local Data Filter( Add Filter( columns( :sex ) ) )
);