func init // checks installation Adobe Acrobat include("AdobeAcrobat") if(linked("onError")) this.setfield('ex', 'ex' + this.id) end end func make_replace(src, dst, st, num) return(dst + '.ReplacePages(' + this.props("StartPage").value + ', ' + src + ', ' + (len(st) ? st : this.props("StartSourcePage").value) + ', ' + (len(num) ? num : this.props("NumPages").value) + ', ' + (isdef("MergeTextAnnotations") ? 0 : '-1' ) + ')') end func doReplacePages(data) src = d("Source") dst = d("Destination") st = d("StartSourcePage") num = d("NumPages") if(len(src) and len(dst)) linked("onError") ? blk.println('try {').inc() : '' if(linked("onResult")) event("onResult", make_replace(src, dst, st, num)) else blk.println(make_replace(src, dst, st, num), ';') end if(linked("onError")) blk.dec().println('} catch(Exception ', this.ex, ') {').inc() event("onError", this.ex + '.Message') blk.dec().println('}') end end end