This new version integrates the power of large language models (LLM). We start in version 9.3.6 with two AI commands: aiPrompt and aiScreenXY. Both use the Anthropic Claude API. Below you find four demo macros to get started with AI and prompting:
AI Demo Macros
Prompt_CompareImages
{
"Name": "Prompt_CompareImages",
"CreationDate": "2024-11-18",
"Commands": [
{
"Command": "aiPrompt",
"Target": "canvas_wyoming_dpi_96.png#canvas_wyoming_dpi_96.png#Are both images the same?\nAnswer only with true or false. Answer in lowercase only.",
"Value": "result",
"Description": ""
},
{
"Command": "echo",
"Target": "Test1: Are the images the same? ${result}",
"Value": "green",
"Description": ""
},
{
"Command": "verify",
"Target": "result",
"Value": "true",
"Description": "Should be false, as the images are NOT the same"
},
{
"Command": "aiPrompt",
"Target": "canvas_wyoming_dpi_96.png#canvas_wyoming_verify_dpi_96.png#\nAre both images the same? Answer only with true or false. NO OTHER TEXT.",
"Value": "result",
"Description": ""
},
{
"Command": "echo",
"Target": "Test2: Are the images the same? ${result}",
"Value": "green",
"Description": ""
},
{
"Command": "verify",
"Target": "result",
"Value": "false",
"Description": "Should be true, as both images are the same"
}
]
}
Prompt_ParseHTML
{
"Name": "Prompt_ParseHTML",
"CreationDate": "2024-11-18",
"Commands": [
{
"Command": "open",
"Target": "https://forum.ui.vision/",
"Value": "",
"Description": ""
},
{
"Command": "executeScript",
"Target": "var str = document.body.innerHTML; // Get page source\n\n//Next: Clean up HTML source before further processing \n\n//First remove scripts and style tags with their content\nstr = str.replace(/<script\\b[^<]*(?:(?!<\\/script>)<[^<]*)*<\\/script>/gi, '');\nstr = str.replace(/<style\\b[^<]*(?:(?!<\\/style>)<[^<]*)*<\\/style>/gi, '');\n \n//Then remove all remaining tags but keep their content\nstr = str.replace(/<[^>]+>/g, '');\n \n//Clean up whitespace\nstr = str.replace(/\\s+/g, ' ').trim();\n \nreturn str;",
"Value": "html",
"Description": "Extract entire HTML code of website"
},
{
"Command": "echo",
"Target": "Entire HTML extracted (long): ${html}",
"Value": "brown",
"Description": ""
},
{
"Command": "aiPrompt",
"Target": "What are the titles of the first 5 forum posts? ${html}",
"Value": "s",
"Description": ""
},
{
"Command": "echo",
"Target": "Title=${s}",
"Value": "green",
"Description": ""
}
]
}
ScreenXY_Browser
{
"Name": "ScreenXY_Browser",
"CreationDate": "2024-11-18",
"Commands": [
{
"Command": "open",
"Target": "https://forum.ui.vision/",
"Value": "",
"Description": ""
},
{
"Command": "XDesktopAutomation",
"Target": "false",
"Value": "",
"Description": ""
},
{
"Command": "aiScreenXY",
"Target": "Find the search icon (magnifying glass).",
"Value": "s",
"Description": ""
},
{
"Command": "echo",
"Target": "Adjusted X,Y coordinates: ${!ai1},${!ai2}, Original Result=${s}",
"Value": "blue",
"Description": ""
},
{
"Command": "XClick",
"Target": "${!ai1},${!ai2}",
"Value": "",
"Description": "Click search icon"
},
{
"Command": "XType",
"Target": "browser automation${KEY_ENTER}",
"Value": "",
"Description": ""
},
{
"Command": "aiScreenXY",
"Target": "Find the first search result (blue text)",
"Value": "s",
"Description": ""
},
{
"Command": "echo",
"Target": "Adjusted X,Y coordinates: ${!ai1},${!ai2}, Original API result=${s}",
"Value": "blue",
"Description": ""
},
{
"Command": "XClick",
"Target": "${!ai1},${!ai2}",
"Value": "",
"Description": "Click first search result link"
}
]
}
ScreenXY_Desktop
{
"Name": "ScreenXY_Desktop",
"CreationDate": "2024-11-18",
"Commands": [
{
"Command": "XDesktopAutomation",
"Target": "true",
"Value": "",
"Description": ""
},
{
"Command": "aiScreenXY",
"Target": "Look for the Ui.Vision IDE. In it, find the Clear button",
"Value": "s",
"Description": ""
},
{
"Command": "echo",
"Target": "Adjusted X,Y coordinates: ${!ai1},${!ai2}, Original Result=${s}",
"Value": "blue",
"Description": ""
},
{
"Command": "XClick",
"Target": "${!ai1},${!ai2}",
"Value": "",
"Description": "Click on Clear button"
},
{
"Command": "echo",
"Target": "Clear button pressed",
"Value": "green",
"Description": ""
}
]
}