|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > AI - Artificial Intelligence Commands > AIX. - Grok / X - API > !Folder Management > AIX - Artificial Intelligence and X Platform Utility |
MiniRobotLanguage (MRL)
AIX.Set Folder
Set the Folder Path for Operations
Intention
Set Folder Command: Define Working Directory
The Set Folder command sets the folder path stored in the global variable AIX_Folder, which serves as the working directory for AIX file operations, such as reading input files or writing output data.
This customizes the file system context for the AI suite.
It’s part of the AIX - Grok / X - API suite.
The Set Folder command updates the global variable AIX_Folder with a specified folder path, which becomes the base directory for file-related operations within the AIX suite.
If a path is provided, it is trimmed of leading/trailing whitespace, tabs, and newlines. If the input is a file path (detected by F_AF), the file name is removed to derive the folder. Trailing backslashes are removed and a single trailing backslash is added. If no path is provided, it retains the current AIX_Folder value. The command also creates the folder if it does not exist using MKDIR.
Setting the folder path is beneficial for:
•Context Customization: Directs operations to a specific directory for input or output files.
•Automatic Setup: Creates the folder if it doesn’t exist, simplifying directory management.
•Portability: Allows scripts to run in different environments by setting the appropriate path.
Use the command to set the folder path in AIX_Folder before executing file-dependent commands like AIX.Analyze Content or AIX.AskVision with file inputs.
Provide a path string (absolute or relative); if it’s a file path, the folder is extracted. Verify the setting with AIX.Get Folder. The command creates the folder if it doesn’t exist.
Example Usage
AIX.Set Folder|""C:\Projects\AIX_Data\input.txt""
AIX.Get Folder|$$PATH
DBP.Current folder path: $$PATH
AIX.Analyze Content|""input.txt""
This example sets a folder path from a file path, retrieves it, and analyzes a file in that directory.
Example with Folder Creation
AIX.Set Folder|""C:\NewFolder""
AIX.Get Folder|$$PATH
DBP.New folder created at: $$PATH
This example sets a new folder path, creates it if it doesn’t exist, and retrieves the path.
Illustration
┌────────────────────┐
│ Set Folder │
├────────────────────┤
│ Input: Path String │───────▶
│ Process: Trim, │
│ Extract, │
│ Create, │
│ Update │
│ Output: AIX_Folder │◀──────┤
└────────────────────┘
A visual of the process: trimming input, extracting folder, creating if needed, and updating AIX_Folder.
Syntax
AIX.Set Folder|path
AIX_Set_Folder|path
Parameter Explanation
path - (Optional) A string (e.g., ""C:\Projects\AIX_Data"" or ""input.txt"") specifying the folder or file path. If a file path is provided, the folder is extracted using PATHNAME$(PATH, ...). If omitted, the current AIX_Folder value is retained.
Remarks
- The folder path is stored in AIX_Folder and affects file-related commands like AIX.Analyze Content.
- The command trims whitespace and ensures a trailing backslash, creating the folder with MKDIR if it doesn’t exist.
Limitations
- Changes apply only to future file operations; existing operations use the previous path.
- If the folder creation fails (e.g., due to permissions), AIX_Folder is still set, potentially leading to errors in subsequent operations.
- Does not handle network paths or UNC paths (e.g., \\server\share) explicitly; behavior depends on MKDIR support.
See also: