I use Windows 11 and Chrome, Desktop action.
My macro stutters after 2 minutes when checking visualSearch.
What could be the reason in Macro:
{
"Name": "Task1 x1",
"CreationDate": "2025-6-28",
"Commands": [
{
"Command": "XDesktopAutomation",
"Target": "true",
"Value": "",
"Description": "Activation of the Desktop Automation mode"
},
{
"Command": "store",
"Target": "NODISPLAY",
"Value": "!replayspeed",
"Description": "GUI-free mode for maximum speed"
},
{
"Command": "store",
"Target": "1",
"Value": "!timeout_wait",
"Description": "Interval 1 second between detections"
},
{
"Command": "visionLimitSearchArea",
"Target": "area=0,0,400,400",
"Value": "",
"Description": "Restricting the search area of an icon"
},
{
"Command": "label",
"Target": "monitor_loop",
"Value": "",
"Description": "Monitoring loop start label"
},
{
"Command": "do",
"Target": "",
"Value": "",
"Description": "Start of iteration"
},
{
"Command": "visualSearch",
"Target": "toprrl_dpi_96.png",
"Value": "found",
"Description": "Icon detection"
},
{
"Command": "repeatIf",
"Target": "${found} == 0",
"Value": "",
"Description": "Repeat if not found"
},
{
"Command": "echo",
"Target": "Icon detected - I send Shift+6",
"Value": "green",
"Description": "Potwierdzenie detekcji"
},
{
"Command": "XRunAndWait",
"Target": "C:\\ui_vision\\ui_hotkeys_koli.bat",
"Value": "shift6",
"Description": "Run the BAT script with the shift6 parameter"
},
{
"Command": "pause",
"Target": "10000",
"Value": "",
"Description": "Wait 10 seconds"
},
{
"Command": "gotoLabel",
"Target": "monitor_loop",
"Value": "",
"Description": "Back to the beginning of the loop"
}
]
}
I have tried using restart in the Macro, but it just stops at the visualSearch line.
What is your advice?
The code I tried to do something with:
{
"Name": "av1 Zadanie1 MIXx2",
"CreationDate": "2025-6-28",
"Commands": [
{
"Command": "XDesktopAutomation",
"Target": "true",
"Value": "",
"Description": "Aktywacja Desktop Automation"
},
{
"Command": "store",
"Target": "NODISPLAY",
"Value": "!replayspeed",
"Description": "Tryb bez GUI dla maksymalnej prędkości"
},
{
"Command": "store",
"Target": "1",
"Value": "!timeout_wait",
"Description": "Timeout 1 s dla visualSearch"
},
{
"Command": "store",
"Target": "0",
"Value": "counter",
"Description": "Inicjalizacja licznika naprzemienności"
},
{
"Command": "store",
"Target": "0",
"Value": "restart_counter",
"Description": "Licznik restartu (20 iteracji)"
},
{
"Command": "visionLimitSearchArea",
"Target": "area=768,870,1012,1005",
"Value": "",
"Description": "Ograniczenie obszaru"
},
{
"Command": "label",
"Target": "monitor_loop",
"Value": "",
"Description": "Pętla monitorowania"
},
{
"Command": "do",
"Target": "",
"Value": "",
"Description": "Start iteracji"
},
{
"Command": "executeScript_Sandbox",
"Target": "return Number(${restart_counter}) + 1;",
"Value": "restart_counter",
"Description": "++restart_counter"
},
{
"Command": "if_v2",
"Target": "${restart_counter} >= 40",
"Value": "",
"Description": "Co 30 iteracji → restart"
},
{
"Command": "echo",
"Target": "RESTART pamięci – iteracja ${restart_counter}/40",
"Value": "orange",
"Description": ""
},
{
"Command": "store",
"Target": "0",
"Value": "restart_counter",
"Description": "Reset restart_counter"
},
{
"Command": "pause",
"Target": "1000",
"Value": "",
"Description": "Pauza 1 s po restarcie"
},
{
"Command": "gotoLabel",
"Target": "monitor_loop",
"Value": "",
"Description": "Powrót do początku pętli"
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": "Koniec restartu"
},
{
"Command": "visualSearch",
"Target": "zpop4n_dpi_120.png",
"Value": "found",
"Description": "Wykrywanie ikony (1 s timeout)"
},
{
"Command": "repeatIf",
"Target": "${found} == 0",
"Value": "",
"Description": "Powtarzaj, jeśli nie znaleziono"
},
{
"Command": "executeScript_Sandbox",
"Target": "return Number(${counter}) + 1;",
"Value": "counter",
"Description": "++counter"
},
{
"Command": "executeScript_Sandbox",
"Target": "return Number(${counter}) % 2;",
"Value": "toggle",
"Description": "Modulo 2"
},
{
"Command": "if_v2",
"Target": "${toggle} == 1",
"Value": "",
"Description": "Shift+1"
},
{
"Command": "echo",
"Target": "Ikona – Shift+1",
"Value": "green",
"Description": ""
},
{
"Command": "XRunAndWait",
"Target": "C:\\ui_vision\\ui_hotkeys_pav1.bat",
"Value": "shift1",
"Description": ""
},
{
"Command": "else",
"Target": "",
"Value": "",
"Description": "Shift+2"
},
{
"Command": "echo",
"Target": "Ikona – Shift+2",
"Value": "blue",
"Description": ""
},
{
"Command": "XRunAndWait",
"Target": "C:\\ui_vision\\ui_hotkeys_pav1.bat",
"Value": "shift2",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": "Koniec if"
},
{
"Command": "pause",
"Target": "10000",
"Value": "",
"Description": "Pauza 10 s po detekcji"
},
{
"Command": "gotoLabel",
"Target": "monitor_loop",
"Value": "",
"Description": "Powrót do pętli"
}
]
}