|
<< 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.Get Folder
Retrieve the Current Folder Path
Intention
Get Folder Command: Access Current Directory
The Get Folder command retrieves the current folder path stored in the global variable AIX_Folder, which is used by the AIX system for file operations such as loading resources or saving outputs.
This allows users to verify or utilize the working directory context.
It’s part of the AIX - Grok / X - API suite.
The Get Folder command retrieves the value of the global variable AIX_Folder, which holds the current folder path used by the AIX suite. This path is set by the AIX.Set Folder command or defaults to an empty string if not set.
The returned path is a string in the operating system’s format (e.g., C:\Projects\AIX_Data\ on Windows or /home/user/aix/ on Unix-like systems), always ending with a trailing backslash (\). The command uses the SL_26 function to store the result in the specified variable.
Retrieving the current folder path is useful for:
•Context Verification: Confirms the directory where files are accessed or saved.
•Dynamic Adjustment: Enables scripts to adapt file operations based on the current path.
•Debugging: Identifies issues if operations fail due to an unexpected folder path.
Use the command to retrieve the current folder path stored in AIX_Folder after it has been set with AIX.Set Folder or to check the default value.
Optionally, specify a variable to store the path; if no variable is provided, the path is returned but not stored. The result can be used in file operations (e.g., FILE.Read) or displayed for user feedback before commands like AIX.Analyze Content.
Example Usage
AIX.Set Folder|""C:\Projects\AIX_Data""
AIX.Get Folder|$$PATH
DBP.Current folder path: $$PATH
FILE.Read|""input.txt""|$$CONTENT
This example sets a folder path, retrieves it into $$PATH, displays the path, and reads a file from that directory.
Example with No Parameter
AIX.Set Folder|""C:\Temp""
AIX.Get Folder|
DBP.Current folder path (implicit): $$R01
This example retrieves the path without storing it in a variable, relying on the implicit return in $$R01.
Illustration
┌────────────────────┐
│ Get Folder │
├────────────────────┤
│ Input: AIX_Folder │───────▶
│ Process: Retrieve │
│ Output: Path String│◀──────┤
└────────────────────┘
▼
[Variable or $$R01]
A visual of retrieving the folder path from AIX_Folder and storing it in a variable or $$R01.
Syntax
AIX.Get Folder|$$variable
AIX_Get_Folder|$$variable
Parameter Explanation
$$variable - (Optional) A variable (e.g., $$PATH) of type WSTRING where the current folder path will be stored. If omitted, the path is returned in $$R01. The path string includes a trailing backslash (e.g., C:\Projects\AIX_Data\).
Remarks
- The folder path is managed by the global variable AIX_Folder, set by AIX.Set Folder, and defaults to an empty string if not set.
- The SL_26 function is used to assign the path to the specified variable or $$R01.
Limitations
- Returns the current value of AIX_Folder without validating its existence or accessibility.
- If AIX_Folder is empty, the command returns an empty string, which may lead to file operation failures if not handled.
See also: