Executing a subroutine from JavaScript

Hi community. We have the following entry in KM Engine scripting dictionary:

doScript method : Execute a macro or action.

doScript text : The name of macro, UID of macro, or plist of action to execute.

[withParameter: text] : A parameter to the macro (in the %TriggerValue% token)

Is it possible to execute a subroutine in a similar way ?

If you set up a simple macro which calls a subroutine, and copy that macro (or the Execute Subroutine action itself) as XML, (KM Editor -> Edit -> Copy As -> Copy As XML), you will see the kind of XML that would need to be passed to .doScript.

Things like:

Expand disclosure triangle to view XML source
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
1 Like