Edit

Deploying Scripts

Scripts are (normally) stored within the MoneyWorks document itself. When you close the scripts window, any changes you have made are writtin to the MoneyWorks document. All of the active scripts will be loaded by every user the next time they log in.

If you want to move them to another MoneyWorks file, you can copy the text out of the script window, then create an empty script in the other document and paste it in there.

Alternatively (and easier) scripts can be saved as an xml file. When such a file is double-clicked in the FInder or Windows Explorer, MoneyWorks will offer to install it into the currently open/connected document. This means you can easily send scripts to other MoneyWorks users. As of MoneyWorks Gold 9.1.4, you also have the option of just activating scripts in a .mwxml on your computer without saving them into a document to be loaded by everyone. You will still need to have the Scripting privilege for the document you are logged into though. You can also do the same for a single script in a .mwscript file which is just a plain text file. For the really advanced, it is also possible to "run" a .mwscript file using the moneyworks command line tool.

To save a script for transfer to other document:

  1. Select the script to deploy by clicking on its name on the sidebar
  1. Click on the Cogs icon on the bottom left of the script window and select Save Selected Script as XML

The standard file dialog will open

  1. Choose the location (and name if desired) for the xml script file and click Save

Note that the file extension must be .mwxml. A copy of the script will be saved as a file in the nominated location.

Other options in the cogs menu:

  • Save all scripts as XML: All scripts will be saved in a single .mwxml file. If such a file is double-clicked (with a MoneyWorks document open), you will be prompted to install each script separately.
  • Copy Script as XML: The script will be copied to the clipboard as XML (and can be pasted into another MoneyWorks file).
  • Copy Script as Styled HTML: The script will be copied as html—handy for documenting your script. The script below was copied in this manner:
  • constant meta = "Hello World"
    on Load
        alert("Hello World")
    end

Deploying selected scripts

You can highlight more than one script (and/or UI Form Layouts, which are also displayed in the sidebar) by Cmd/Ctrl clicking on each one in the sidebar. The cogs pop-up menu then has the option to save the selected scripts. You actually don't need to travel down to the cogs menu; you can right-click on a selection of scripts to get the menu right under your mouse.