Skip to content

Writing Scripts

The Foxel API consists of over 30 modules containing a total of more than 350 functions that allow you to control almost every aspect of Foxel. If you're wondering where to start, it's important to note that Foxel itself utilizes its own API. Every time you interact with the user interface and an API function is called, that call, along with all used parameters, is logged to the system log file and displayed in the console window.

The system log file can be found at: /Documents/Foxel/Log/system.log. In the console window, all API call logs are highlighted in yellow, making them easy to identify.

Example of an API Call

For instance, if you open an asset from the Quick Access Panel, the following line is logged:

lua
2025-06-19 15:01:57 API       : FxFile.Open(111, "Asset1");

In this log entry, the first part indicates the date and time of the call, followed by the log type "API" (there are also other types such as Info, File, and Cache to indicate what action caused the log). After the colon, you see the actual API call: FxFile.Open(111, "Asset1");.

You could copy that line into a script to open the asset named "Asset1". However, before doing so, you need to load the module FxFile, as the Lua compiler will not understand what the string "FxFile" means without it. To load the module, add the following line at the top of your script:

lua
FxFile = require "FxFile";

Understanding the API Call

The function FxFile.Open takes two arguments: FileType and FileID.

  • FileType: This is an integer value that tells the file manager what type of file to open. Foxel supports various file types, including assets, color palettes, mini sets, etc.
  • FileID: This is the name of the asset as it is listed in the Assets Panel.

By understanding how to read and utilize the API calls logged in the system log, you can effectively write scripts that interact with the Foxel environment and automate various tasks.