|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > AI - Artificial Intelligence Commands > AIU. - OpenAI API > !Operator Mode > AIU. - Artificial Intelligence Utility |
MiniRobotLanguage (MRL)
AIU.Screenshot
Captures the screen, a window, or a specific region.
Intention
The AIU.Screenshot command (aliased as AIU.Shot) is a fundamental tool for the Operator Mode. It captures a visual snapshot of the screen, which can then be sent to a vision-capable AI model for analysis. The command can capture the entire desktop, the currently active window, or a specific rectangular region.
The command saves the capture to a temporary PNG file and returns a structured string containing the file path and metadata about the capture. This result is designed to be passed directly to the AIU.OperatorAddResult command.
Illustration
┌─────────────────────────────────┐
│ SPR Command │
├─────────────────────────────────┤
│ AIU.Screenshot|desktop|$$RES │
├────────────┬────────────────────┤
│ Action │ Result in $$RES │
├────────────┼────────────────────┤
│ Captures │ C:\path\img.png|...│
│ Screen │ + metadata │
└────────────┴────────────────────┘
Capturing the screen and returning a metadata string.
Syntax
AIU.Screenshot|$$TGT|$$RET
AIU.Screenshot|region|$$X|$$Y|$$W|$$H|$$RET
Parameter Explanation
P1 - $$TGT - (Variable, String, Required)
The target to capture. Valid values are: "desktop", "active_window", "active_window_client", or "region".
P2..P5 - $$X, $$Y, $$W, $$H - (Variables, numeric, Required if P1 is "region")
The top-left coordinates (X, Y) and dimensions (Width, Height) of the rectangular area to capture.
Final Param - $$RET - (Variable, String, Required)
The variable where the structured result string will be stored.
Examples
'***********************************
' AIU.Screenshot - Sample 1: Capture Active Window
'***********************************
AIU.Screenshot|active_window|$$RES
' $$RES now contains a string like: "C:\path\img.png|active_window|..."
MBX.Capture Result:|$$RES
END.
'***********************************
' AIU.Screenshot - Sample 2: Capture a specific region
'***********************************
VAR.$$X_C=100
VAR.$$Y_C=150
VAR.$$WID=400
VAR.$$HGT=300
AIU.Screenshot|region|$$X_C|$$Y_C|$$WID|$$HGT|$$RES
MBX.Region Capture Result:|$$RES
END.
Remarks
- The alias AIU.Shot can be used for convenience.
- The output string is pipe-delimited (|) and contains the following fields in order:
filepath|capture_type|orig_w|orig_h|sent_w|sent_h|resize_method|desktop_x|desktop_y
- This command is primarily intended to be used within the Operator Mode workflow, where its output is passed to AIU.OperatorAddResult.
See also: