Article View: adobe.scripting.indesign
Article #2315Re: AddEventListener afterOpen to Document
From: Dave_Saunders
Date: Wed, 24 Dec 2008 19:22
Date: Wed, 24 Dec 2008 19:22
23 lines
1534 bytes
1534 bytes
I just jumped on this bandwagon. When I realized that afterOpen fires before the first window appears, I tried opening one in my event handler:
//DESCRIPTION: Start-up Script
#target indesign
#targetengine 'onOpen'
(function() {
app.eventListeners.add("afterOpen", afterOpen);
function afterOpen(myEvent) {
myEvent.target.windows.add();
}
}())
This worked. The window was drawn. But when I tried to close the window, InDesign CS4 crashed. To be thorough, I shall now go through the process again to make sure it is repeatable ... Yes it is. I just tried again with a different document -- happens it was one that had to be converted from CS3. Same thing happened. One window only which on closing caused the crash.
Then, restarting CS4 caused the document to be recovered with two windows.
Looks like APID is the way to go if you want to do anything useful with a document when it opens.
Dave
Technical Details
Message-ID:
<59b71ef3.1@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!newshub.sdsu.edu!webcrossingReferences:
<59b71ef3.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,2bd1055e76c10932 X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Dave_Saunders@adobeforums.com Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: AddEventListener afterOpen to Document Message-ID: <59b71ef3.1@webcrossing.la2eafNXanI> Date: Wed, 24 Dec 2008 11:22:19 -0800 References: <59b71ef3.-1@webcrossing.la2eafNXanI> Lines: 28 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit