AIU. - Artificial Intelligence Utility

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIU. - OpenAI API > !Folder Management >

AIU. - Artificial Intelligence Utility

AIU.SetFolder

Previous Top Next


MiniRobotLanguage (MRL)

 

AIU.SetFolder
Set the AIU Folder Path for File Operations

 

Intention

 

SetFolder Command: Configuring the AIU Folder Path
 
The SetFolder command allows you to specify a custom folder path for AIU file operations, such as storing API keys or generated files.

This provides flexibility in managing where AIU-related files are saved or accessed within your scripts.

It’s part of the AIU - OpenAI API suite.

 

What is the SetFolder Command?

 

The SetFolder command updates the AIU_Folder global variable, which defines the default directory for AIU file operations.

If the specified folder doesn’t exist, the command attempts to create it. The path is normalized to end with a backslash (\) for consistency.

 

Why Do You Need It?

 

Setting a custom AIU folder path is essential for:

Customization: Tailor the storage location to your project’s structure.

Organization: Keep AIU-related files separate from other script data.

Portability: Ensure scripts work across different systems by setting absolute paths.

 

How to Use the SetFolder Command?

 

The command requires a single parameter—the folder path—or can be called without parameters to reset to the default folder.

By default, AIU_Folder is initialized to ?exeloc\AIU_Folder\ during the Init_AIU() call.

 

Example Usage

 

AIU.SetFolder|C:\MyAIUFiles

DBP.Folder set to: C:\MyAIUFiles\

AIU.GetFolder|$$FOL

DBP.Current folder: $$FOL

 

This sets the AIU folder to C:\MyAIUFiles\ and verifies it with AIU.GetFolder.

 

Illustration

 

┌───────────────┐

│ AIU_Folder    │

├───────────────┤

│ C:\MyAIUFiles\│

└───────────────┘

The AIU_Folder path after setting it to a custom directory.

 

Syntax

 

AIU.SetFolder[|P1]

AIU.Set_Folder[|P1]

 

Parameter Explanation

 

P1 - (Optional) The folder path to set for AIU operations. If omitted, resets to the default ?exeloc\AIU_Folder\.

 

Example

 

AIU.SetFolder|D:\AIU_Data

AIU.GetFolder|$$PAT

DBP.New AIU Folder: $$PAT

ENR.

 

Remarks

 

- The folder path is trimmed of leading/trailing whitespace and normalized to end with a backslash (\).

- If the folder doesn’t exist, the command attempts to create it using MKDIR.

 

Limitations

 

- The command does not validate folder accessibility beyond attempting to create it.

- Only one parameter is accepted; additional parameters trigger an error.

 

See also:

 

AIU.Get_Folder

AIU.Save_Key

Folder Management

AIU.Generate_File