Congratulations on your first post.
There are examples in the Scripting Guide that should help you to interpret the simple example I am providing below.
Help==>Books==>Scripting Guide
Names Default To Here( 1 );
dt = Current Data Table();
nw = New Window( "Name data table",
<<Modal,
<<Return Result,
Text Box( "What do you want to name the data table?" ),
tableName = Text Edit Box( " ", <<set width( 400 ) )
);
If( nw["button"] == 1 & nw["tableName"] != "",
dt << set name( nw["tableName"] )
);
Jim