< Previous | Contents | Next >
Commandline Scripts
In the install directory of Fusion an application called FuScript is available, which allows to run scripts directly from the command line.
FuScript <script> [args]
The mac version is to be found inside the app bundle at Fusion.app/Contents/MacOS/fuscript. FuScript can execute a .lua script file directly:
The passed args can be accessed by the script via arg[1], arg[2] … arg[n], while arg[0] is reserved to point at the path of the script being executed.
FuScript also has an interactive shell which can be started with:
FuScript -i
For other uses of FuScript run it without any argument. A list of possible arguments will be printed to the console.
comp = composition
SetActiveComp(comp)
composition = fu.CurrentComp
fu = fusion
fusion = Fusion()
To connect FuScript to a running instance of Fusion use the following snippet:
From now on, the interactive shell will act like the build in shell in Fusion. By calling
SetActiveComp(comp), the global scope will accept calls to the composition. For example, the creation of tools like this:
blur = Blur()
FuScript <script> [args] -l python2
FuScript <script> [args] -l python3
This command will create a blur tool on the FlowView of the current open composition. To run python version 2 or 3 you can specify the language like this: