Jump to content
Sign in to follow this  
Morkus

Functions don't work if ScriptMaster is unloaded?

Recommended Posts

I unloaded ScriptMaster database and the script that was working in the other FileMaker Pro database stopped working (Missing function error then appears in script). If I restart the ScriptMaster database, then the script in the other FileMaker Pro database that uses it works again.

So, being somewhat confused by this....do I need to purchase the $95 subscription and create and install a plug-in in FMP so the function works without the ScriptMaster database being loaded or am I missing something?

I made sure I clicked the "Register" button at the bottom of the ScriptMaster database after first checking the function I wanted. However, that function is "Missing" in the other FileMaker Pro database if ScriptMaster database isn't loaded at the same time.'

--

Also, if I have ScriptMaster on FMS 12 Advanced, do I need to restart it every two hours?

--

Look forward to clarification.

Thanks in advance,

- m

Share this post


Link to post
Share on other sites

I quote from the documentation>>

http://360works.com/plugins/SCRIPTMASTERPLUGIN/documentation.html

Now that you've registered the function, you're almost ready to start using it in your solution. The only problem is that functions only remain registered while FileMaker is running - if you were to quit FileMaker and start it back up, the module you just registered would no longer appear in the FileMaker functions list. We'll discuss three options for registering ScriptMaster modules every time you open your solution file.

The first option requires ScriptMaster Advanced Edition....

The second option is to simply check the 'register on startup' box from the registration screen (the layout that you are taken to after clicking the 'register' button). All modules with this option enabled are registered every time you open the ScriptMaster.fp7 file....

The third option is the most complex, but it does not require ScriptMaster Advanced Edition, and it does not require you to include the ScriptMaster.fp7 file with your solution. In the module registration screen, click the button that says 'Copy to clipboard', which puts all of the registration code onto your clipboard. Now go to the startup script in your FileMaker solution, add a 'set variable' script step (you can name the variable anything you like), and paste in the registration code as the formula to calculate. Now the function will be registered every time that your startup script runs.....

IMHO, once you get it the third option is not really that difficult.

Share this post


Link to post
Share on other sites

I just put the ScriptMaster.fmp12 file on the FileMaker Pro server and it's running while the server is running. It seems to work OK.

I had Register on Startup checked so hopefully there won't be any timeout issues.

I couldn't find the "Copy to clipboard" button you referred to for option 3, but it sounds like we should be OK.

I haven't seen documentation on how to create a brand new script, but maybe I've just missed that.

Thanks very much for your kind reply.

-m

Share this post


Link to post
Share on other sites

To get to the "Copy to Clipboard" button you'll want to click the "Register Function" button near the bottom of each module details layout. Then you can follow the rest of the instructions for option 3 referenced above.

You mentioned wanting to create a new script, is it correct to assume you are talking about a new module/function? In that case you simply create a new module record and fill in the appropriate variables and Groovy/Java code you wish to implement.

Share this post


Link to post
Share on other sites

Ok, by "start up script" you mean File...File Options...Script Triggers ....OnWindowFirstOpen, right?

If I create a $Register variable in a script called Register and paste it with what's below the script still does not run unless ScriptMaster is open separately. (I associated the OnWindowFirstOpen with that script.)

I also have the ScriptMaster file running on the server, but it still seems to be necessary to have it open ... locally.

I'm also confused what is meant by needing to distribute the ScriptMaster.fmp12 file "with" the solution. Does that mean have it running on the server at the same time (doesn't seem to work) or something else?

What am I missing?

Thanks,

-- m

RegisterGroovy( "PostDataToURL( key ; value ; url )" ; "// Construct data¶

String data = URLEncoder.encode(key, "UTF-8") + "=" + URLEncoder.encode(value, "UTF-8");¶

// use something like the following to send multiple key/value pairs¶

// data += "&" + URLEncoder.encode(key2, "UTF-8") + "=" + URLEncoder.encode(value2, "UTF-8");¶

// Send data¶

URL url = new URL(url);¶

URLConnection conn = url.openConnection();¶

conn.setDoOutput(true);¶

OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());¶

wr.write(data);¶

wr.flush();¶

// Get the response¶

String response = conn.getInputStream().getText("utf-8");¶

wr.close();¶

return response;"; "isGui=false" )

Share this post


Link to post
Share on other sites

Put the ScriptMaster plug in on the Server and enable it.

Create a script with the RegisterGroovy as the first line, save it, then run it once to create the function locally, then write the rest of your script, including the function.

Close the file and put it on the server.

Create a server schedule that runs that script in that file at a time, and it will work on the server. So you could post to a wsdl, create a new record, set a field with the result, and do it all again 5 minutes later ( or loop through all records that have a flag set to do them one at a time). The results will then appear on your desktop or Go version.

There is a massive difference to how scripts run on a client to the server as indicated in answers to your other questions.

Perhaps reading the documentation I linked to above would be a good start.

Share this post


Link to post
Share on other sites

Here is one of my startup scripts.

It passes my registration for purchased items and registers functions for ScriptMaster

Share this post


Link to post
Share on other sites

Method 2 (open file, close file) and including ScriptMaster.fmp12 with the solution is so slow on the server it isn't even worth considering. The delay time for ScriptMaster to load and go through all the records is about 30 seconds. Really ugly.

Although I'm impressed with ScriptMaster at a basic level, I think we're going to head a different direction and use JDBC externally so we aren't in this bind or have to pay $95/yr.

If there were extensive programming documentation (a "how to" manual, tutorials, etc.) programming ScriptMaster scripts, we might consider it in the future. The documentation on the Web site, though a good start, isn't really enough.

Appreciate all the help on this! :)

Share this post


Link to post
Share on other sites

I'm not sure how many modules you have selected to register in the ScriptMaster file but 30 seconds does seem like it may be a little long. I would strongly suggest using the option mentioned above and copy/paste the code into a script executed at startup instead.

There is also the option of generating a custom plugin (ScriptMaster Advanced) and I wanted to make clear that if you go that route you do not have to pay $95 each year to continue using the plugins you create. You only renew if you will need the advanced features (custom plugin creation, access to FM clipboard, access to SQL engine) beyond the original license.

Also, unless you have a specific need to execute this on the server the plugin can be installed and run on the client instead. Here are installation locations for both scenarios. We also make available an autoupdate script for each of our plugins to help automate the installation/update functions. Some basics about how our plugins work can be found here.

The documentation for ScriptMaster is really about how to use the plugin and the sample file. However to modify or create custom plugins a decent understanding of Groovy/Java is necessary. There are many resources for these online (Java, Groovy) to learn more about how to program in those languages. There is really no way to create "extensive programming documentation" as the possibilities for what can be done with ScriptMaster are basically limitless.

One other thing you might find useful is a ScriptMaster video created by Matt Petrowsky. It is extensive (41 minutes) but has a brief preview that may prove useful as well.

I also want to mention that we have a JDBC plugin that might be useful to you as well. This is not a free plugin but we provide a full featured demo of the plugin for testing purposes.

Share this post


Link to post
Share on other sites

Regarding the ScriptMaster Video above, I had tried to view it, but apparently some "subscription" ($) is requried?

Appreciate all your great replies.

Share this post


Link to post
Share on other sites

Second that Brent....

I have over 80 active functions in regular use doing everything from heavy duty PDF manipulation, XML and JSON processing, some really clever tricks that are physically impossible in FM, through to talking to Google calendar, Trello, FogBugz to name a few

Rather than just buy another plug in, this has enabled me to significantly extend the reach of FileMaker by teaching me how to 'roll my own' functions, and given the overall scope of Java and the brilliant methods in Groovy the sky is pretty much the limit.

The is a great difference between just giving the answer to showing the way to a place where you learn how to craft the tools to do the job. You can use a chisel to open a paint can, but there is very little point when you can carve a statue with it.

John

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

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