Having been burned badly in the past copying tables between documents, I'm reluctant to guide you down that path -- although in the description you posted in the opening message you never seem to be copying the table back into the original document -- is that right? You want to end up with the table in a different document?
Why can't you do the tasks you describe in situ? In a script, you don't have to worry about what would be tedious and repetitive if done by hand.
To identify a table from a selection you can use this function; just pass into it a reference to the selection, as shown:
myTable = getTable(app.selection[0]);
function getTable(obj) { if (obj instanceof Table) return obj; obj = obj.parent; if (obj instanceof Application == false) { return getTable(obj); } returnnull;}
Now you have a reference to the table, you can manipulate it in many ways, including convert it to text if you insist.
myText = myTable.convertToText("\t", "\r")
Now you have a reference to the text -- notice that you don't have to select it to process it.
I don't have any more time right now because the family is going out and I have to go with them.
Dave