|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > ! User-Macros > PAT. - Pattern Recognition Command |
MiniRobotLanguage (MRL)
PAT. Command
Screen Pattern Recognition and Text Finding
Intention
The PAT. command provides access to the SymbolRecognition library for finding text and patterns on the screen. Key features:
• Best Match Return: PAT.FindText returns only the best match (highest confidence) directly
• ARR.-Array Support: PAT.FindTextArr stores ALL matches in an ARR.-Array
• Actual Point Set: When a match is found, the actual point (MRP) is automatically set to the center
• Screen Capture: Capture screen regions to BMP files
• Symbol Detection: Detect symbols at specific screen locations
Important Notes
PAT.FindText vs PAT.FindTextArr:
PAT.FindText|OK|Arial|12|0.80|$$R
Returns: "123|456|50|20|0.95" (x|y|width|height|confidence) of the BEST match only
PAT.FindTextArr|Button|5
Stores ALL matches in ARR.5, each element as "x|y|w|h|conf"
Actual Point (MRP):
When a match is found, the Actual Point (MRP) is automatically set to the center of the match. This allows subsequent commands like CLC. (Click) to work directly at that location.
Subcommands
Initialization:
• PAT.Init - Initialize pattern recognition
• PAT.Shutdown - Shutdown and cleanup
• PAT.IsInit - Check initialization status
Configuration:
• PAT.SetFont - Set default font
• PAT.SetConf - Set confidence threshold
Text Search:
• PAT.FindText - Find text, returns best match as "x|y|w|h|conf"
• PAT.FindTextArr - Find all matches, store in ARR.-Array
• PAT.GetPos - Get text position
• PAT.Exists - Check if text exists
• PAT.WaitFor - Wait for text to appear
Screen Capture:
• PAT.Capture - Capture screen region
• PAT.CaptureFull - Capture full screen
Utilities:
• PAT.Version - Get library version
• PAT.LastError - Get last error
Example
PAT.Init
PAT.SetFont|Tahoma|14
' Find single best match
PAT.FindText|OK|Arial|12|0.80|$$Result
' $$Result = "123|456|50|20|0.95"
' MRP is automatically set to center (148, 466)
CLC.1 ' Click at MRP
' Find all matches into ARR.-Array
ARR.Clr 5
PAT.FindTextArr|Button|5
' ARR.5 now contains all "Button" matches
' Each element: "x|y|w|h|conf"
PAT.Shutdown
See Also
• IPT. - If Pattern condition
• JPT. - Jump if Pattern
• ARR. - Array commands