func init // checks installation Adobe Indesign and adds references include("AdobeIndesign") // adds assembly references if(this.props("VersionCS").value == '5.0') sys.add_assembly('Interop.InDesign', 'Interop.InDesign.dll', 'assembly\\AdobeCS5.0\\') elseif(this.props("VersionCS").value == '5.5') sys.add_assembly('Interop.InDesign', 'Interop.InDesign.dll', 'assembly\\AdobeCS5.5\\') elseif(this.props("VersionCS").value == '6.0') sys.add_assembly('Interop.InDesign', 'Interop.InDesign.dll', 'assembly\\AdobeCS6.0\\') end // initialize instance sys.add_var(this.name, 'id.EventListener') // makes implementation methods for properties sys._prop_init('.EventType', 1, 0, 2) sys._prop_init('Handler', 1, 0, 0) sys._prop_init('Id', 1, 0, 1) sys._prop_init('Index', 1, 0, 1) sys._prop_init('.Label', 1, 1, 2) // makes implementation of simple methods sys._method_init('Delete') // makes implementation of methods as properties sys._mtd_as_prop_init('EventListener') end func doAdd(data) blk.println(this.codename, ' = ', this.make_add_event(data), ';') sys.set_typed_field(2, 'Label', '', '', blk) event("onAdd", this.codename) end func make_add_event(data) obj = d("Object", 20) if((typeof(obj) == 5) and (obj.size() == 2)) instance = obj.get(0) event_type = obj.get(1) else instance = obj event_type = d("EventType", 2) end return(instance + '.AddEventListener(' + event_type + ', ' + d("EventHandler") + ')') end