use the uuid property
var idoc = app.activeDocument;
alert(idoc.textFrames[0].uuid);
to find items by their uuid use the following
var idoc = app.activeDocument;
//alert(idoc.textFrames[0].uuid); // 5501
var tframe = idoc.getPageItemFromUuid (5501);
tframe.contents = "new content";