Alternate ways for selecting I/O paths in the IO Setup Window
Hey team - the coverage of NAMM looked great, hope it went well. I'll probably get out there next year...
I'm working on a pretty elaborate script, and one big part of it is selecting busses and paths within the IO setup window. Everything's working great, however, the only way I've been able to successfully get it working the way I intend is to have quite large pauses between elementClick() actions (it needs to have the ability to select various paths). The reason for this seems to be that the elementClick function is working too fast and acts like a double click function so in actuality what ends up happening is it'll select bus 1 successfully, 3 successfully, 5 successfully etc.
I also tried keyboard modifiers instead of the waits, but it was the same issue. Any ideas? Here's the function in question currently:
function selectBusNames() {
const ioSetupWindow = sf.ui.proTools.windows.whoseTitle.is("I/O Setup").first;
const allRows = ioSetupWindow.tables.whoseTitle.is("Bus Setup").first.children.whoseRole.is("AXRow")
.whoseValue.is("# 0 row Row is empty.").invalidate().map(x => x);
allRows.forEach(row => {
// Access the cell that contains the path name
const cell = row.children.whoseRole.is("AXCell").allItems[3]; // Adjust the index if needed
const cellValue = cell.textFields.first.value.invalidate().value;
if (targetBusNamesRegex.test(cellValue)) {
sf.wait({ intervalMs: 300 }); // Small delay, e.g., 300 milliseconds
cell.elementClick();
sf.wait({ intervalMs: 300 }); // Small delay, e.g., 300 milliseconds
}
});
}
- Chris Shaw @Chris_Shaw2024-01-30 04:53:44.458Z
It may not work in this instance, but I've found that when I can't get a click to work as expected then using two click actions separated by 15-20ms can work (ie: mouseDown, sf.wait 15ms, mouse up).
- TTristan Hoogland @Tristan
Hey Chris - hope you've been well man!
Thanks for that hot tip, it certainly worked in speeding things up, however, the moment it gets to the end of what's visible on the page in the IO set up it just keeps moving down the window (hits buttons like create new path, default, etc).
The only other two solutions I came up with were the following. They do work despite feeling a bit clunky, but I'll take what I can get for now. Will likely put some small waits in there to be sure.
if (targetBusNamesRegex.test(cellValue)) { cell.elementClick(); ioSetupWindow.radioButtons.whoseTitle.startsWith("Bus").first.elementClick(); }
if (targetBusNamesRegex.test(cellValue)) { cell.elementClick(); cell.elementClick().success }