Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

how to add EventListener in VB.NET

New Here ,
Aug 04, 2008 Aug 04, 2008
I want to use Pure VB.NET Code to handle the InDesign events through the ComObject.

I found the EventListener.Add function. However, I don't know how to use it.

Anyone can tell me? thx
TOPICS
Scripting
2.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 04, 2008 Aug 04, 2008
Hi AhWa,

Have you tried the scripting documentation? It's at the InDesign scripting home page, which is listed at the top of this forum. The chapter on working with events should answer your question.

You can add your event listener using VB.NET, but you'll probably have to call a VBScript or JavaScript on disk as the event handler.

Thanks,

Ole
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 04, 2008 Aug 04, 2008
Hi Ole,

I had read the scripting document. and try to port the VBScript codes to be VB.Net Codes. However, EventListener.Add() required a Object
type handler. So that I have no idea about what should I pass such type for this parameter.

I wounder, Is it possible that a pure VB.Net coded Application driving the Indesign DOM Object with event handler?

Really don't want to deal with the C++.

Thanks,
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 04, 2008 Aug 04, 2008
Hi AhWa,

Here's the template for the EventListeners.Add method:

Function Add(EventType As String, Handler, [Captures As Boolean = False]) As EventListener

The qualifying event strings for the EventType parameter are shown in the documentation. The Handler parameter is a reference to a file--a VBScript file on disk. The event will pass parameters to this file when it triggers.

As I said, I don't think you can have a "pure" VB.NET application that works with events.

You're welcome to try the C++ API (which doesn't work with events in the same way at all), but I think you'd be better off using VBScripts for the event handlers.

Thanks,

Ole
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 05, 2008 Aug 05, 2008
LATEST
Thank you Ole,

Finally, I give out the "pure" VB.NET approach and move to pure C++ approach. The Scripting API did not provide sufficient event for my project.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines