Does that error come with a line number?
Yes, it's saying the error is on line 2. Thanks for any assistance you can provide!
is the document opened?
var myDocument = app.documents.item('Source.indd');
var myDocument = app.open(File('C:\Users\jdoe\Desktop\Source.indd'));
Thank you! I had not thought about the backslash being an escape character, I don't do this very often. Very helpful reminder!
Thanks so much! That was the issue, I hadn't realized the document needed to be opened first, which is obvious now that I think about it. I had to make sure the file opened with no window (using "false" in the app.open) so the current document wouldn't lose focus, but it works perfectly now.
For the sake of others, here's the final script:
var myDocument = app.open(File('C:\\Users\\jdoe\\Desktop\\Source.indd'), false);
var sourcePages = myDocument.pages.item(0);