Custom Action (Advanced)

Runs a Python script with configurable UI parameters.

This action is similar to the Run Python Script action, but more flexible, especially when used as a preset. Behind the scenes, it also runs a script, but it isn’t directly visible in the workflow editor. Instead, you can configure custom parameters that look just like the ones in the other built-in actions (text boxes, switches, radio buttons...).

The script can then access these parameters (using the workflow.get_parameters() function) to do something with them. This makes the script a lot easier to reuse, because you don’t have to edit the source code to run it with different parameters. It’s also more convenient for scripts that need multiple inputs.

Parameters

The parameters for this action are completely customizable. To add/edit parameters, tap on the options (▼) button and select “Edit Parameters”.

There are five different types of parameters available:

  • Single-line Text: A simple text field that can also contain a single variable.
  • Multi-line Text: A multi-line text box that can contain both text and variables. When the script is run, the variables are already resolved to their current values.
  • Switch: An on/off switch. The resulting value in the script is True or False
  • Single Choice: A list of radio buttons or a popup menu (for more than 3 options). The value in the script is the zero-based index of the selected option.
  • Code: Similar to the multi-line text parameter type, but uses line numbers and an extended code keyboard. The text cannot contain any workflow variables.

You can also insert comments in the parameter list – they are shown as static labels.

To access the parameter values from the Python script, you can use the workflow.get_parameters() function. When the script is run, variables in text parameters are already replaced by their actual values.