Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

SM register funtion and copy to clipboard

Featured Replies

SSssoooooo ... my java function works fine in SM and if registered by SM works in my file when called.

My problem is that after I have it registered and I click the 'Copy to clipboard' in SM I have nothing to paste. I tried a direct copy/paste from the actual field which works though.....

It's a fairly long one that requires me to escape a lot of quotes and edit (insert

"¶"
 ??) so that somewhere along the way I've missed something and my version wont work.



Suggestions on how to get what SM is registering or else what all has to be edited basically?



PS -  I can't post the code because it's not mine......... but something like this one from SM:





   String[] command = new String[3];

  	command[0] = "cmd";

  	command[1] = "/C";

  	command[2] = "dir";

//  	command[3] = "c:\\temp";

  	Process p = Runtime.getRuntime().exec(command);

  	BufferedReader stdInput = new BufferedReader(new

  	InputStreamReader(p.getInputStream()));

   

  	BufferedReader stdError = new BufferedReader(new

  	InputStreamReader(p.getErrorStream()));

  	// read the output from the command

  	String s = "";

 	String a = "";

  	while ((s = stdInput.readLine()) != null) {

  	a = a + s + "\n";

  	}



  	// read any errors from the attempted command

  	while ((s = stdError.readLine()) != null) {

  	a = a + s + "\n";

  	}

  	return a;

Some help would be appreciated !!

I don't see the 'Copy to Clipboard' option in SM. What version of SM plug-in are you using? Is your ScriptMaster.fp7 file up to date? (I may have just missed it, as I don't need that feature)

Regardless, the Demo::copyable field holds the data I think you need, so view it in the data viewer, and copy it's value, or add it to a layout, or do whatever you have to to get it's contents.

  • Author

Regardless, the Demo::copyable field holds the data I think you need, so view it in the data viewer, and copy it's value, or add it to a layout, or do whatever you have to to get it's contents.

AAAaaaa Thank you. However that didn't help.

I'm looking over it closely but one section is greyed out. A copy/paste and restart left me where I was.....

I don't see the 'Copy to Clipboard' option in SM. What version of SM plug-in are you using? Is your ScriptMaster.fp7 file up to date? (I may have just missed it, as I don't need that feature)

I have the latest....

After You click to 'Register Function' it takes you to a layout allowing you 3 options

...Generate Plug in

...Register with this file

...Paste into your solution (which has a clickable 'copy to clipboard')

Have a look at the field definition for the Demo::copyable field; it adds pilcrow's (¶) to keep the code readable, but maybe that is causing issues for you if your code uses pilcrow's. Try this...

Quote( Demo::script )

I have the latest....

After You click to 'Register Function' it takes you to a layout allowing you 3 options

...Generate Plug in

...Register with this file

...Paste into your solution (which has a clickable 'copy to clipboard')

Now I see it!

  • Author

Have a look at the field definition for the Demo::copyable field; it adds pilcrow's (¶) to keep the code readable, but maybe that is causing issues for you if your code uses pilcrow's. Try this...

Quote( Demo::script )

Is this the field used by SM to register it? Or is there something else?

I may have found the problem.... original script had 2 sections that were 'escaped' (//) in a row. Upon deleting 1 the section turned black again.

Trying it out now...........

NOPE!!! UGH!!!!

Also having a 'Stupid' Moment......:angry:

Startup Script - Set Variable

name - $$XYZ (Global or not ??)

value - RegisterGroovy( "whatever" ; "whatever" )

Using later in a script ...

set variable: Do I use the same '$$XYZ' as name but now value is the 'whatever ; whatever' ?? right??

Then I'm using insert calc. , with variable $$XYZ, into field.

Is this the field used by SM to register it? Or is there something else?

Yes, Demo::script is the field that is used to register the Function. If you go into layout mode, you will see that is the field that holds your script code.

Have you tried capturing the output of Quote( Demo::script ), then using it to register the function?

It sounds like you may be using an up-to-date version of the demo file, but an older version of the actual ScriptMaster plugin. Make sure you are using 4.124 by going to filemaker->preferences->plugins tab-> select scriptmaster and look at the version which is loaded.

You do not need to modify any of the ScriptMaster.fp7 scripts to make registering or copying functions to the clipboard work.

  • Author

It sounds like you may be using an up-to-date version of the demo file, but an older version of the actual ScriptMaster plugin. Make sure you are using 4.124 by going to filemaker->preferences->plugins tab-> select scriptmaster and look at the version which is loaded.

You do not need to modify any of the ScriptMaster.fp7 scripts to make registering or copying functions to the clipboard work.

Using 4.124 ......

Still have nothing in the clipboard

....so I tried to copy - Demo::copyable and paste into my file ..... didn't work.

Tried - copying

Quote( Demo::script )

My others are working fine so I'm at a loss........

Do you have any other plugins installed? Make sure that all of your plugins are up-to-date, including non-scriptmaster plugins. Having an older plugin installed may interfere with the functionality of newer plugins. If you do not have any other plugins installed, or all of your installed plugins are up to date please give me a call and we can do screensharing and take a look at your system.

  • Author

Do you have any other plugins installed? Make sure that all of your plugins are up-to-date, including non-scriptmaster plugins. Having an older plugin installed may interfere with the functionality of newer plugins. If you do not have any other plugins installed, or all of your installed plugins are up to date please give me a call and we can do screensharing and take a look at your system.

Thanks for the reply ... I may be taking you up on it as I still haven't solved the problem.

I deleted all other plugins - no difference

I disabled all other variables - no difference

All other variables from SM (like - check if file exists, etc) that I use work fine

I feel as though it's something in the java itself that somehow wont let my file register it. I'm gonna try 2 more things and then... if you don't mind .... before we screenshare I'd like to PM you a copy of the java to look at and see what you think.

  • 2 weeks later...
  • Author

UPDATE : My problem was I didn't realize that the Jars weren't being loaded by my file.

I added a table for Jars in my file with a single container field (it'll work better with their script)

I added new records and imported all the Jars I need for my variables

I imported the 'Load all Jars' script from SM

Corrected any issues

Set it to run in my Open script before I loaded my variables

THANKS to David from SM360 for calling me back and helping me fix this !!!!

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.