Jump to content

RegisterGroovy Formatting


This topic is 2835 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

Link to comment
Share on other sites

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" )

Link to comment
Share on other sites

This topic is 2835 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.