If you want to perform an action on all of the data tables that are currently open (except for private tables), use N Table() to get a list of references to each one:
dt1 = Open( "$SAMPLE_DATA/Cities.jmp" );
dt2 = Open( "$SAMPLE_DATA/Big Class.jmp" );
openDTs = List();
For( i = 1, i <= N Table(), i++,
Insert Into( openDTs, Data Table( i ) );
);
openDTs now is a list of references to all open data tables. You can send messages to any one by using openDTs(n). You can use a for loop to send messages to all of the open data tables. This loop adds a new column named My Column to each open data table.
For( i = 1, i <= N Items( openDTs ), i++,
openDTs[i] << New Column( "My Column" );
);
If you just want a list of table names and not references, use the Get Name message:
For( i = 1, i <= N Table(), i++,
Insert Into( openDTs, Data Table( i ) << Get Name());
);