Here is an example of how you might script this process.
 
Names Default to Here( 1 );
dialog = New Window( "Optional Factor", << Modal,
	Outline Box( "Choice",
		Text Box( "Add X4?" ),
		Text Box( "Click OK to add" ),
		Text Box( "Click Cancel to skip" )
	),
	H List Box(
		Button Box( "OK" ),
		Button Box( "Cancel" )
	)
);
doe = DOE( Custom Design,
	{Add Response( Maximize, "Y", ., ., . ),
	Add Factor( Continuous, -1, 1, "X1", 0 ),
	Add Factor( Continuous, -1, 1, "X2", 0 ),
	Add Factor( Continuous, -1, 1, "X3", 0 ), Set Random Seed( 30650037 ),
	Add Term( {1, 0} ), Add Term( {1, 1} ), Add Term( {2, 1} ), Add Term( {3, 1} ),
	Add Term( {1, 1}, {2, 1} ), Add Term( {1, 1}, {3, 1} ),
	Add Term( {2, 1}, {3, 1} ), Set Sample Size( 12 ), Simulate Responses( 0 ),
	Save X Matrix( 0 )}
);
// add 4th factor and the associated main effect and interaction terms
If( dialog["Button"] == 1,
	doe
		<< Add Factor( Continuous, -1, 1, "X4", 0 )
		<< Add Term( {4, 1} )
		<< Add Term( {1, 1}, {4, 1} )
		<< Add Term( {2, 1}, {4, 1} )
		<< Add Term( {3, 1}, {4, 1} )
);