Copy link to clipboard
Copied
my code:
var myApplicationEventListener = app.eventListeners.add("afterImport", myEventInfo);
function myEventInfo(myEvent){
var myImportedObj=????????? ///HELP!!!
if (myImportedObj.constructor.name=="Story")
{processStory(myImportedObj)}
}
function processStory(myStory){
//blah blah blah blah
//blah blah blah blah
}
how cand i get that myImportedObj?? the parent and the target of the event is "Document".
Hi Vamitul,
Your handler just listens to an ImportExportEvent (myEvent), which does not tell you what the imported file is placed as. (At this stage, in fact, the object is not placed yet.) That kind of event can only address the underlying file—through myEvent.fullName—but this is not the thing you are looking after…
Instead, you should use: app.eventListeners.add("afterPlace", myEventInfo)
This way myEvent.target will address the actual DOM object which results from any placing operation.
@+
Marc
Copy link to clipboard
Copied
Hi Vamitul,
Your handler just listens to an ImportExportEvent (myEvent), which does not tell you what the imported file is placed as. (At this stage, in fact, the object is not placed yet.) That kind of event can only address the underlying file—through myEvent.fullName—but this is not the thing you are looking after…
Instead, you should use: app.eventListeners.add("afterPlace", myEventInfo)
This way myEvent.target will address the actual DOM object which results from any placing operation.
@+
Marc
Copy link to clipboard
Copied
Thank you!
a wird thing happens with "afterPlace": sometimes the taget is a story, sometimes is a textframe..