Hi. I created a script for my table which I am hoping that when I right-click "Run Script" it would execute my script and display some graphs. However, when I run my main code, the graphs are automatically displayed and when I right-click "Run Script" afterwards it does nothing. I would need your help pointing out the error on my code. Thanks.
 
Below is a section of the long code.
 
aGraph = Graph Builder(
	Size( xSize, ySize ),
	Show Control Panel( 0 ),
	Variables( X( :V ), Y( :I ), Overlay( :PID ) ),
	Elements( Points( X, Y, Legend( 4 ), Jitter( 1 ) ), Line( X, Y, Legend( 6 ), Row order( 0 ), Summary Statistic( "Mean" ) ) ),
	SendToReport(
		Dispatch( {}, "ID", ScaleBox, {Scale( "Log" ), Format( "Best", 12 ), Inc( 1 ), Minor Ticks( 1 )} ),
		Dispatch( {}, "Graph Builder", FrameBox, {Marker Size( 1 ), Line Width Scale( 0.1 )} )
	)
);
bGraph = Graph Builder(
	Size( xSize, ySize ),
	Show Control Panel( 0 ),
	Variables( X( :V ), Y( :I ), Overlay( :PID ) ),
	Elements( Points( X, Y, Legend( 3 ), Jitter( 1 ) ), Line( X, Y, Legend( 5 ), Row order( 0 ), Summary Statistic( "Mean" ) ) ),
	SendToReport(
		Dispatch( {}, "IG", ScaleBox, {Scale( "Linear" ), Format( "Best", 12 ), Inc( 1 ), Minor Ticks( 1 )} ),
		Dispatch( {}, "Graph Builder", FrameBox, {Marker Size( 1 ), Line Width Scale( 0.1 )} )
	)
);
			
// Create new script
dt << New Script(
	"Plot Graph", 
				
	graphWindow = New Window( "Graphs",
		Panel Box( "Graphs",
			V List Box(
				H List Box(
					If( !Is Empty( aColumns ),
						aGraph
					), 
								
					If( !Is Empty( bColumns ),
						bGraph
					)
				)
			)
		)
	)
);