Write your own Bash script
Beside pre-built scripts, Trickest Platform provides a
custom-script node to write your own script from scratch.
Custom-script node is completely empty script implemented as a Bash, with a pre-installed Ubuntu 20.04.4 LTS.
The example below is the showcase of composing random commands and writing result to the out/output.txt. The output of this node can be forwarded further in the workflow simply by connecting its file output to the next node input.
The example above is trivial, and it's only proof of flexibility - with well-crafted Bash command, anything can be achieved, including various dana generation, cleaning, filtering or manipulation, integration or communication with external services etc.
Write your own Python script
This shell script has an equivalent python script node, conveniently named
python-script. You can learn more about it in this article which includes its basic usage, what libraries are installed by default, and how to install your own libraries.
# Python 3
# List of pre-installed libraries: https://docs.trickest.io/tutorials/building-a-workflow/using-scripts#pre-installed-libraries
# You are currently inside the /hive directory
# Input node files/folders are accessible through /hive/in/NODE_ID (e.g. cat in/amass-1/output.txt)
# To output a file/folder, write it to the /hive/out directory
# Useful paths
INPUT_FOLDER = "/hive/in/"
OUTPUT_FOLDER = "/hive/out/"
OUTPUT_FILE = OUTPUT_FOLDER + "output.txt"
### Start Here
with open(OUTPUT_FILE, 'w') as f:
Rename AnytimeRename custom-script or python-script nodes anytime by selecting a given node in the Canvas and editing its name (label) at the top of the Object Inspector (Right Sidebar).
Use onceCustom-scripts and python-scripts written as a part of a specific workflow can't be saved and reused in another workflow.