@Learner – you first have to open an InDesign file to get contents out of it.
Once opened you can refer the document object by its name or index or id.
There is the open() methods, both with the app object and the file object (plus some options).
Also an openDlg() and an openDialog() method for the File object with some options, if you want the user to chose from files. You also could build your own open dialog with ScriptUI using the above methods.
Just search for some examples in this forum.