func init // checks installation Adobe Indesign and adds references include("AdobeIndesign") // initialize instance sys.add_var(this.name, 'id.Document') end func doNew(data) if(linked("Document") or not isdef("Name")) blk.println(this.codename, ' = ', this.make_new(data), ';') event("onComplete", this.codename) else event("onComplete", this.make_new(data)) end end func Document if(sys.is_linked(1) or not isdef("Name")) return(this.codename) else return(this.make_new()) end end func make_new(data) return(d("Indesign", 20)+ '.Documents.Add(' + sys.get_typed_field('true', 'ShowingWindow', 104) + ', ' + sys.get_typed_field('Type.Missing', 'DocumentPreset', 20) + ')' ) end