Edit

External (command, parameters, ...)

Definition:  Executes an external helper command which must be installed in ~/Library/Application Support/Cognito/MoneyWorks Gold/Externals (Mac) or "C:\Users\USERNAME\AppData\Roaming\Cognito\MoneyWorks Gold\Externals" (Windows) (prior to v 7.1.6 it was the Standard plugins Scripts folder). The parameters are passed to the executable and the return value of the function is the helper's stdout output.

On Mac, the external command can be any unix executable (typically it will be a shell script). Be sure to set the executable bit when installing. If you want to implement your external using Applescript, you can make an Applescript-as-shell-script using

#!/usr/bin/osascript

on the first line.

On Windows, the external command can be a .exe, a .vbs, .js, or a .bat. A VBS script will be executed in console mode.

Support for javascript externals on Windows is new in v8.

Example: 

let r = External("myhelper.exe", "param1", "param2")

On Windows, externals cannot receive parameters that contain a quotation mark (U+0022), due to limitations of the Windows command line system. For these externals, MoneyWorks 7.1.5 and later will replace any quote characters with the trigraph ??'. Your external will need to transform these trigraphs in each argument to the quote character. e.g. in vbs, Replace(strArg,"??'",chr(34)). Either that or avoid using quotes.

Availability:  The External function is available in MWScript in version 7.1 and later. The location for Externals changed in v7.1.6