Edit

To Create a New Script

  1. Click the plus icon at the bottom left of the scripts window

You will be asked to enter the script name.

Note that the name must be unique (you cannot have two scripts with the same name).

The Add a new UI Form option is used to design and create your own windows. This is covered in the UI Builder section.

  1. Enter the script name and click OK

A new script will be created.

As an example, copy and paste the following script into the editor for your new script:

    constant meta ="My Hello World"
        
    on Load
        Alert("Hello World!")
    end
  1. Click Run Once.

Your Load handler will be called and the alert will be displayed. The script will then be unloaded. One and done.

While this is a good way to test things out, it's not useful for adding features to MoneyWorks. For that you want the script to remain active and respond to events.

  1. Now change the script to the following:
    constant meta ="My better Hello World"
    
    on Hello
        Alert("Hello World!")
    end
    
    on Load
        InstallMenuCommand("Hello World", "Hello")
    end

If you click Run Once, nothing will (apparently) happen. The Load handler installs a menu command but then it will be removed when the script is auto-unloaded.

  1. Instead, click Activate in the toolbar

Your script is compiled and loaded, and remains active. Look in the Commands menu and you will find your new command at the bottom called "Hello World".

When you select this menu item, MoneyWorks will call your Hello handler. Congratulations! you've added a feature to MoneyWorks.

At this point, with the script activated, if you close the script window and log out of the document and then log back in, your Hellow World command will still be there, because the script will be reloaded when you log in. Furthermore, if you are logged into a document on MoneyWorks Datacentre, closing the script window (or Saving) will save the scripts to the document and when anyone else logs in, they will also get your Hello World command! (if they were already logged in, they will get the changes the next time they log in).

To Delete an Existing Script

  1. Select the script to Delete by clicking on its name on the sidebar
  1. Click on the Cogs icon on the bottom left of the script window and select Delete Script

You will be asked for confirmation

  1. Click OK to delete the script

To Rename a Script

  1. Select the script to rename by clicking on its name on the sidebar
  1. Click on the Cogs icon on the bottom left of the script window and select Rename Script
  1. Enter the new script name (which must be unique) and click OK

The script will be renamed and deactivated. You will need to reactivate the script if required.

Note: If the script contains a public handler, any other scripts that use that handler will also be deactivated. You will need to alter the handler calls in these other scripts to reflect the new script name.