func init // checks installation Adobe Indesign 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._Application') // make methods for properties sys._prop_init('ActiveBook', 1, 0, 0) sys._prop_init('ActiveDocument', 1, 0, 0) sys._prop_init('ActiveScript', 1, 0, 2) sys._prop_init('Documents', 1, 0, 0) sys._prop_init('FilePath', 1, 0, 2) sys._prop_init('FullName', 1, 0, 2) sys._prop_init('Locale', 1, 0, 0) sys._prop_init('ModalState', 1, 0, 104) sys._prop_init('Name', 1, 0, 2) sys._prop_init('SerialNumber', 1, 0, 2) sys._prop_init('Version', 1, 0, 2) sys._prop_init('Visible', 1, 0, 104) // makes implementation of simple methods sys._method_init('Activate') // initialize constructor if(not (linked("doConstructor") or linked("Application") or isdef("Name"))) this.constructor('', blk_init) end end func doConstructor(data) this.constructor(data, blk) event("onComplete", this.codename) end func doQuit(data) blk.println(this.codename, '.Quit(', sys.get_typed_field('id.idSaveOptions.idAsk', 'SaveOptions', 14, 'id.idSaveOptions'), ');') end func constructor(data, blkout) blkout.println(this.codename, ' = (id._Application)Activator.CreateInstance(Type.GetTypeFromProgID("InDesign.Application"));') .println(this.codename, '.ScriptPreferences.UserInteractionLevel = ', sys.get_typed_field('id.idUserInteractionLevels.idInteractWithAll', 'InteractionLevel', 14, 'id.idUserInteractionLevels'), ';') sys.event_type("onAfterActivate", "afterActivate") sys.event_type("onAfterClose", "afterClose") sys.event_type("onAfterContextChanged", "afterContextChanged") sys.event_type("onAfterOpen", "afterOpen") sys.event_type("onAfterQuit", "afterQuit") sys.event_type("onAfterSelectionAttributeChanged", "afterSelectionAttributeChanged") sys.event_type("onAfterSelectionChanged", "afterSelectionChanged") sys.event_type("onBeforeDeactivate", "beforeDeactivate") sys.event_type("onBeforeNew", "beforeNew") sys.event_type("onBeforeOpen", "beforeOpen") sys.event_type("onBeforeQuit", "beforeQuit") end func doAddEventListener(data) blk.println(this.codename, '.AddEventListener("', this.props("EventType").value, '", ', d("EventHandler"), ', ', d("Captures", 104, 'false'), ');') end func Application if(not linked("doConstructor")) this.constructor('', blk) end return(this.codename) end