Thread View: adobe.scripting.indesign
11 messages
11 total messages
Started by matt_p_stone
Tue, 27 Jan 2009 23:01
Open Dialog doesn't open files
Author: matt_p_stone
Date: Tue, 27 Jan 2009 23:01
Date: Tue, 27 Jan 2009 23:01
13 lines
1301 bytes
1301 bytes
I am using the following to browse for multiple files to open.
var myFileMain = File.openDialog ("Select a file", "Documents:*.indd",false);
However, when I add this line to display the files I get the error "undefined, not an object"
var myLayoutWindow = myDocument.windows.add();
I have even just copied the snippet from the Official Scripting Guide to see if I was causing the error with my first line but I get the same error here for the second line.
var myDocument = app.open(File("/c/myTestDocument.indd"), false);
var myLayoutWindow = myDocument.windows.add();
So I tried switching the first line to true instead of false but then in testing in Indesign I get the message that no documents are open.
Can anyone point out what I am doing wrong?
Re: Open Dialog doesn't open files
Author: Dave_Saunders
Date: Tue, 27 Jan 2009 23:12
Date: Tue, 27 Jan 2009 23:12
6 lines
768 bytes
768 bytes
The open dialog returns a file object that you must open:
var myFileMain = File.openDialog ("Select a file", "Documents:*.indd",false);
var myDocument = app.open(myFileMain);
Dave
Re: Open Dialog doesn't open files
Author: matt_p_stone
Date: Tue, 27 Jan 2009 23:20
Date: Tue, 27 Jan 2009 23:20
3 lines
737 bytes
737 bytes
Thank Dave, you've been a great help again. One question; any idea why the documentation states to add a window rather than this function?
Re: Open Dialog doesn't open files
Author: Dave_Saunders
Date: Wed, 28 Jan 2009 04:15
Date: Wed, 28 Jan 2009 04:15
3 lines
631 bytes
631 bytes
Which documentation where? Dave
Re: Open Dialog doesn't open files
Author: matt_p_stone
Date: Wed, 28 Jan 2009 16:21
Date: Wed, 28 Jan 2009 16:21
8 lines
743 bytes
743 bytes
Sorry I wasn't clear. InDesignCS3_ScriptingGuide_JS.pdf from Adobe. I'm using the CS3 version since that is the version of ID I have. Thanks again, Matt
Re: Open Dialog doesn't open files
Author: Dave_Saunders
Date: Wed, 28 Jan 2009 17:13
Date: Wed, 28 Jan 2009 17:13
3 lines
760 bytes
760 bytes
Could you give me a page reference? Or better yet quote the text that led you astray? Dave
Re: Open Dialog doesn't open files
Author: Olav_Kvern
Date: Wed, 28 Jan 2009 17:17
Date: Wed, 28 Jan 2009 17:17
13 lines
1259 bytes
1259 bytes
Hi Matt,
re: "I have even just copied the snippet from the Official Scripting Guide to see if I was causing the error with my first line but I get the same error here for the second line.
var myDocument = app.open(File("/c/myTestDocument.indd"), false);
var myLayoutWindow = myDocument.windows.add();"
The first question--do you have a file named "myTestDocument.indd" on a drive named "c"?
The second parameter controls whether the document opens with a visible window or not. If you omit it or change it to true, you don't need the line that creates a new window.
Thanks,
Ole
Re: Open Dialog doesn't open files
Author: matt_p_stone
Date: Wed, 28 Jan 2009 18:03
Date: Wed, 28 Jan 2009 18:03
24 lines
2141 bytes
2141 bytes
Hi Dave & Olav,
First to Dave; quote is below. From page 12.
You can choose to prevent the document from displaying (i.e., hide it) by setting the showing window
parameter of the open method to false (the default is true). You might want to do this to improve
performance of a script. To show a hidden document, create a new window, as shown in the following
script fragment (from the OpenDocumentInBackground tutorial script):
//Opens an existing document in the background, then shows the document."
//You�ll have to fill in your own file path."
var myDocument = app.open(File("/c/myTestDocument.indd"), false);"
//At this point, you could do things with the document without showing the"
//document window. In some cases, scripts will run faster when the document"
//window is not visible."
//When you want to show the hidden document, create a new window."
var myLayoutWindow = myDocument.windows.add();
Second for Olav,
In actuality I changed the "myTestDocument.indd" to an actual file and I did try changing the false to true (didn't try omit even though I know that it will default to true).
The error message occurs when the next line executes. Error "No Documents are open". The snippet Dave gave above fixed the problem, but it would seem from the documentation that the above solution should work as well.
I hope this is clear enough. Not really a big deal for me at this point since Dave's solution worked, just wanted to know if I was missing something major in interpretation.
Thank you both for your time and expertise.
Re: Open Dialog doesn't open files
Author: Dave_Saunders
Date: Wed, 28 Jan 2009 19:36
Date: Wed, 28 Jan 2009 19:36
3 lines
801 bytes
801 bytes
You either didn't understand or didn't read the example well enough. You have to open the document before you can display a window. Your original code located the document file but didn't open it. Dave
Re: Open Dialog doesn't open files
Author: Wim_Bijnens
Date: Mon, 02 Feb 2009 21:53
Date: Mon, 02 Feb 2009 21:53
13 lines
984 bytes
984 bytes
Hello,
CAn somebody help me?
I'm trying to open a file with the code below, but I get a security error (no access to the file) Please tell me what is wrong...
Code:
myIndesign = new ActiveXObject("IndesignServer.Application.CS3");
var myDocument = myIndesign.open("E:\test\tagged.indd", false);
Thanks,
Wim
Re: Open Dialog doesn't open files
Author: Olav_Kvern
Date: Mon, 02 Feb 2009 21:57
Date: Mon, 02 Feb 2009 21:57
9 lines
847 bytes
847 bytes
Hi Wim, You should start a new topic, because your message has nothing to do with the thread you've posted it in. To create an instance of InDesign server, use CreateObject, as shown in all of the example scripts. Thanks, Ole
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads