For anyone trying to use the PathText.jsx example from the InDesign CS4 JavaScript scripting examples... it needs two changes to work:
1. Change line 20 from:
var myDocument = documents.item(0);
to:
var myDocument = app.documents.item(0);
2. Change either line 17 from:
var myRectangle = myPage.textFrames.add({geometricBounds:[72, 72, 288, 288]});
to:
var myRectangle = myPage.rectangles.add({geometricBounds:[72, 72, 288, 288]});
or, line 24 from:
var myRectangle = myPage.rectangles.item(0);
to:
var myRectangle = myPage.textFrames.item(0);