func init // checks installation Adobe Photoshop and adds references include("AdobePhotoshop") // initialize instance if(linked("Document") or not isdef("Name") or not user_level) sys.add_var(this.name, 'ps.Document') end end func doOpen(data) if(linked("Document") or not isdef("Name") or not user_level) blk.println(this.codename, ' = ', this.make_open(data), ';') event("onComplete", this.codename) else event("onComplete", this.make_open(data)) end end func doOpenDialog() blk.println('object[] items = ', d("Photoshop", 20), '.OpenDialog() as object[];') .println('if (items != null) {').inc() .println('foreach (string item in items) {').inc() if(linked("Document") or not isdef("Name")) blk.println(this.codename, ' = ', this.make_open(sub('item', 2)), ';') event("onComplete", this.codename) else event("onComplete", this.make_open(sub('item', 2))) end blk.dec().println('}') .dec().println('}') end func Document if(sys.is_linked(1) or not isdef("Name") or not user_level) return(this.codename) else return(this.make_open()) end end func make_open(data) return( d("Photoshop", 20) + '.Open(' + d("Path") + ', ' + d("DocumentType", 20, 'Type.Missing') + ', ' + d("SmartObject", 104, 'false') + ')') end