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.

Create your own .jar file

Featured Replies

I have been playing with the ScriptMaster plug-in for the last few days and was stumbling through creating a .jar file with my own code, which could be accessed from any function. Since I did not find any information on how to do this in this forum, I thought I would add my findings here...

I used the 'CreateFolder' function included with ScriptMaster as an example.

1. Write Class Code

class MyFunctions{

    def CreateFolder(path){

        File dir = new File(path);

        if( dir.exists() ) return false;

        if( dir.mkdirs() ) { //Success!

            return true;

        } else { //Figure out why it failed

            File realParent = dir;

            while( realParent != null && ! realParent.exists() ) {

                realParent = realParent.getParentFile();

            }

            if( realParent != null && !realParent.canWrite() ) {

                throw new FileNotFoundException("Directory " + dir.getAbsolutePath()

                    + " could not be created because the parent directory "

                    + realParent.getAbsolutePath() + " is not writeable" );

            } else {

                throw new FileNotFoundException("Directory + " + dir.getAbsolutePath()

                    + " could not be created because of an unknown error." );

            }

        }

    }

}


Save File As: MyClasses.java

the class name should begin with an uppercase letter (or so I read somewhere)





2. Compile

groovyc MyClasses.java


  • (this will create a MyClasses.class file)
3. Create .jar file run from the command line:
jar cf MyJar.jar MyFunctions.class


  • (this will create a MyJar.jar file)
4. Add .jar to ScriptMaster.fp7, test
  • go to 'Jar Libraries'
  • create new record, insert the MyJar.jar file
  • go to 'ScriptMaster Modules'
  • create a New Record, give your test function a name
  • select the MyJar.jar file on the 'Jars' tab
  • create a parameter named: pathToCreate
  • enter this code for the function


example = new MyFunctions()

example.CreateFolder(pathToCreate)
cross your fingers **, hoping it will work, then run the script

* Groovy is optional, you could write your class entirely in Java, then use 'javac' to compile rather than 'groovyc'

** finger crossing is also optional

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.