External

External (command, parameters, ...)

External() executes an external helper command which must be installed in <Application Support/AppData>/Cognito/MoneyWorks Gold/Externals/ (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, or a .bat. A VBS script will be executed in console mode.

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

Posted in Functions | Comments Off on External