Command Line Function in Automate w/ tutorial

by Minh Le

Version 1 (March 1, 2026)

Download (15 downloads)

(Read contacts/calender permission is due to content query block, which only reads automate flows)

This is an extension of my run function that allows multiline scripting and environment control with Automate flows. More instructions how to use inside msg dialogs/on run.

@global (statement=1) cmd(env, commands, callerUri*, api*) => __run__, args*

/** Low cost (2 blocks) function caller that stores and manages the call and return stacks

@param env (dictionary) :
Current environment, usually derived from the flow beginning payload

@param commands (string) :
Commands to run. This must be formatted properly to be parsed. Commands follow the syntax:
$uri_or_function_name(giveVar, new return_key-of-function(takeVar, new returnTo(result1, new2 continueTo(result)
$statements/1 ()"
}
*/

@Example (statement=6) function2(arg1, arg2, arg3, arg4, arg5)

@global (statement=5) import