Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Hello

I have a FMP solution I did under FMP12 using some scripts from Scriptmaster ; everything runs fine !

Opening this solution in FMP14 Adv when one FM script using SM is executed I get a warning window I join a screen copy. I precise that after that the FM script runs fine till its end.

I don't understand at all what is said and don't know in what direction I must search to avoid this alert.

Thank for your help !

Noël

Capture d'écran 2020-04-18 14.25.25.png

Posted

post the code Noel.....

it is to do with the way Groovy 'guesses' or overloads methods based on what it thinks you are working with

So for example if you pass 2 in a function it will guess this is an integer number but if you pass 2.5 it will assume it is the decimal type -both of which are different, and if you pass "2" it will assume this is a string

Somewhere a null value is being used and the code is not trapping for this as an error, neither does Groovy know what to do with that as it could do multiple things.

This is due to a change of Java I think.

Posted (edited)

Hello

I just run the FM script step bys step. And so I found the error : and Scriptmaster is not guilty; it was on CopyFile (src; dest) that the alert occurred. Here is the code

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();¶
}"; "isGui=false" )

The error was in the definition of the paths for MacOS only ! Sorry to have disturbed uselessly !
Keep yourself healthy!

Noël

 

Edited by Noél Dubau
Posted

Thanks Noel

 

To stop this happening again either do an explicit test for a null input path, or add a catch (e) at the then of your code

 

Try{

//code

} finally {

//code

} catch (e) {

//return a logical error message]

}

 

  • 9 months later...
Posted

Hello John

Many things occured in my life and took me far from FileMaker all the year long.

I don't understand what code I must include and how ; would you be kind to help me more ?

Noël

Posted

this???

 

//src = input path
//dest = output path


input = new BufferedInputStream(new FileInputStream(src))
out = new BufferedOutputStream(new FileOutputStream(dest))
try {
	out << input
} finally {
	if (out != null) {out.close()}
	if (input != null) {input.close()}
} catch (e) {
	return e.getMessage()
}

 

Posted

Sorry but always disturbed by problems...

I have not the script before registering the function... and don't know how to include the code you give ...

and that error box occurs in many sm functions

 

Posted

The error message says

I have this result (null) but there are several possibilities for what kind of object you mean and so I can't make any guess what you really need here, because if I guess wrong then the next thing might fail.

If you use a try { } notation then anything that goes wrong in the code in the middle you will get an error. If you tell the code to deal with it then you are in charge of what is returned - this is just the same as in FileMaker when you turn on error capture

 

The code needs to look like 

try { do something.... } catch (anyerror) { do something with the error }

 

because of how Groovy is written then all this gets simplified to the code I shared

try {

something 

} catch (e) {
// give back a result with the message part of the error
return e.getMessage()
}

 

This topic is 1397 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.