Skip to content

Running Scripts from the Command-Line โ€‹

Foxel can execute a script directly from the command line.

Use this to automate tasks or integrate Foxel into external workflows.

Command Format โ€‹

Run Foxel with the -run argument:

text
path\to\Foxel.exe -run scriptname

The script argument can be one of the following:

  • The name of a shared script as it appears in Foxel.
  • The full path to a .lua script file.

Shared script names are matched case-insensitively.

Examples โ€‹

Run a shared script:

text
C:\Program Files\Foxel\Foxel.exe -run MyScript

Run a script from a file path:

text
C:\Program Files\Foxel\Foxel.exe -run "C:\Scripts\MyScript.lua"

Behavior โ€‹

When started in command-line mode, Foxel opens, executes the script, and then closes automatically after the script finishes.

A window and rendering context are still created, which allows scripts to perform operations that require them.

Exit Codes โ€‹

Foxel returns the following exit codes:

  • 0 โ€” Script executed successfully.
  • 102 โ€” Script file was not found.
  • 902 โ€” Script execution failed.

These exit codes can be used in batch files, build pipelines, or other automated workflows.

Example Script โ€‹

This example writes a message to the log:

lua
FxLog = require "FxLog"
FxLog.WriteTrace("Hello World!")