Also, this script from Adobe Intro to Scripting PDF is not working in InDesign CC 2014 either:
var myDoc = app.documents.add(7, 10)
var docHeight = myDoc.height
var docWidth = myDoc.width
myDoc.resizeCanvas((docHeight - 2), (docWidth - 2))
The error coming back on the first line is:
Invalid value for parameter 'showingWindow' of method 'add'. Expected Boolean, but received 7.
Are you trying to run Illustrator scripts in Indesign?
Those are two very different products with very different object models. Closest analogy i can find is you wondering why the wheels from your car don't fit a tank.
Well, the scripting guide should tell you for what application does each script is meant for. If you are trying to learn, the try to read it fully, not just skim over what seems interesting.