June 22, 20169 yr The following is the "Copy File" function from the ScriptMaster FMP12 file. It works as it should. I need to register it as a function, and am having problems getting the return state back (because I don't know enough Java): *************************************************** InputStream input = new BufferedInputStream(new FileInputStream(src)); OutputStream out = new BufferedOutputStream(new FileOutputStream(dest)); try { out << input; } finally { if (out != null) out.close(); if (input != null) input.close(); } return true; *************************************************** This is what I was trying to use as a formula in a Set Variable step of an initialization script. *************************************************** RegisterGroovy( "CopyFile( src ; dest )" ; " InputStream input = new BufferedInputStream(new FileInputStream(src)); OutputStream out = new BufferedOutputStream(new FileOutputStream(dest)); try { out << input; } finally { if (out != null) out.close(); if (input != null) input.close(); } return true;") *************************************************** Please help me get tot he correct formatting of the RegisterGroovy function. Thanks, Paul Samuelson
June 23, 20169 yr Paul, If you register the function in the Scriptmaster file by clicking on "Register Function" at the bottom of the module, it will take you to another layout that tells you how to incorporate the module. The third choice gives you an option to copy to your clipboard. This will be the correct syntax to paste into a set variable script step. Have you done this? This is what I get when I copy it to the clipboard RegisterGroovy( "CopyFile( src ; dest )" ; "InputStream input = new BufferedInputStream(new FileInputStream(src));¶ OutputStream out = new BufferedOutputStream(new FileOutputStream(dest));¶ try {¶ out << input;¶ } finally {¶ if (out != null) out.close();¶ if (input != null) input.close();¶ }¶ ¶ return true;"; "isGui=false" )
Create an account or sign in to comment