|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Internet and Network > MCP. - MCP (Model-Context Protocol) server operations > Screenshot Tools - Screen capture operations > MCP Commands - Screenshot Tools |
MiniRobot Language (MRL) - MCP Screenshot Tools Commands
MCP.ShotGetLastRatio / SHOT.GETLASTRATIO
Get Last Screenshot Ratio
Purpose
The SHOT.GETLASTRATIO command calculates and returns the aspect ratio (width divided by height) of the most recently captured screenshot. This ratio is useful for maintaining proportions when scaling or displaying screenshots, validating capture dimensions, or determining screen orientation.
This command is particularly useful when:
• Scaling screenshots while maintaining aspect ratio
• Validating screenshot dimensions meet requirements
• Determining screen orientation (landscape vs portrait)
• Comparing aspect ratios across different captures
• Calculating proportional coordinates within the screenshot
Syntax
SHOT.GETLASTRATIO|$$RETURN_VAR
Parameters
$$RETURN_VAR - The variable that will receive the aspect ratio value (width / height) of the last screenshot.
Return Value
The command returns the aspect ratio as a floating-point number representing width divided by height. Common values include:
1.778 (16:9 widescreen display)
1.333 (4:3 standard display)
1.600 (16:10 display)
0.562 (9:16 portrait mobile)
If no screenshot has been taken, 0 is returned.
Examples
' Example 1: Get aspect ratio of last screenshot
SHOT.SCREEN|$$FilePath
SHOT.GETLASTRATIO|$$Ratio
PRT.Screenshot aspect ratio: $$Ratio
' Example 2: Check if screenshot is widescreen
SHOT.SCREEN|$$FilePath
SHOT.GETLASTRATIO|$$AspectRatio
IVV.$$AspectRatio>1.7
PRT.Widescreen capture detected
ELS.
PRT.Standard aspect ratio
EIF.
' Example 3: Calculate scaled height from width
' Capture screenshot and get its ratio
SHOT.SCREEN|$$Path
SHOT.GETLASTRATIO|$$OriginalRatio
' Calculate proportional height for target width of 800
MAT.800/$$OriginalRatio|$$ScaledHeight
PRT.Scaled dimensions: 800 x $$ScaledHeight
Remarks
The SHOT.GETLASTRATIO command calculates the ratio from the dimensions of the most recent screenshot. The ratio is computed as width divided by height, which means values greater than 1.0 indicate landscape orientation, values less than 1.0 indicate portrait orientation, and exactly 1.0 indicates a square image.
The returned value is a floating-point number with several decimal places of precision. For comparison purposes, consider using a tolerance range rather than exact equality checks.
MCP.ShotGetLastRatio and SHOT.GETLASTRATIO are aliases for the same command. You can use either form.
Error Conditions
The command will fail with an error if:
• The return variable parameter is missing
• The ScreenshotTools feature is disabled in the server configuration
• Too many parameters are provided
See also:
• SHOT.SCREEN - Capture Screenshot
• SHOT.GETLASTRECT - Get Last Screenshot Rectangle
• SHOT.GETQUADRECT - Get Quadrant Rectangle