Bounce between start/end markers not working in PT 2023
Hi all!
Hoping someone can advise as I'm not experienced enough with code. Been using the script attached for a few years on every project and it's great, but it's stopped working with my M1 Mac Studio/Ventura/PT 2023.6. Tried similar forum post codes but getting the same issue.
Simply meant to bounce between Start/End markers and copy the project name. The error is:
"Couldn't locate AxElementArrayIndexedItem (Line 25)"
Any help very appreciated!
sf.ui.proTools.mainWindow.invalidate();
const sessionPath = sf.ui.proTools.mainWindow.sessionPath;
const sessionFileName = sessionPath.split('/').slice(-1)[0].split('.').slice(0, -1).join('.');
function getMemoryLocations() {
sf.ui.proTools.appActivate();
sf.ui.proTools.mainWindow.elementRaise();
var i = 0;
while (i++ < 5) {
if (!sf.ui.proTools.memoryLocationsWindow.invalidate().exists) {
sf.ui.proTools.getMenuItem('Window', 'Memory Locations').elementClick({}, 'Could not click to open Memory Locations window');
sf.ui.proTools.memoryLocationsWindow.elementWaitFor();
}
var table = sf.ui.proTools.memoryLocationsWindow.invalidate().tables.first;
if (!table.exists) {
sf.ui.proTools.memoryLocationsWindow.windowClose();
}
}
if (!table.exists) throw 'Could not find memory locations table';
var seed = (new Date).valueOf();
var items = [];
table.children.forEach(function (item, i) {
var num = item.children[0].children[0].title.value;
var text = item.children[1].children[0].title.value;
if (num === null || text === null) return;
items.push({
num,
text,
});
});
return items;
}
function selectBetweenMemoryLocationsByName({ name1, name2 }) {
let locations = getMemoryLocations();
let location1 = locations.find(l => l.text === name1);
let location2 = locations.find(l => l.text === name2);
if (!location1) throw `Could not find a memory location by name '${name1}'`;
if (!location2) throw `Could not find a memory location by name '${name2}'`;
let locNum1 = Number(location1.num.trim());
let locNum2 = Number(location2.num.trim());
sf.ui.proTools.memoryLocationsGoto({
memoryLocationNumber: locNum1,
useKeyboard: true,
});
sf.ui.proTools.memoryLocationsGoto({
memoryLocationNumber: locNum2,
extendSelection: true,
useKeyboard: true,
});
}
selectBetweenMemoryLocationsByName({
name1: 'Start',
name2: 'End',
});
sf.keyboard.press({
keys: "cmd+numpad 5, cmd+alt+b",
});
sf.keyboard.type({
text: sessionFileName,
});
- Kitch Membery @Kitch2023-07-14 08:00:04.630Z
Hi @Ru_Lemer,
There is a good chance that what you are seeing is due to some major changes that were made to the markers functionality in the latest version of Pro Tools, which we have addressed in the latest version of SoundFlow.
Please install the latest version of SoundFlow (version 5.4.2) from my.soundflow.org/install
Let me know if that fixes the issue for you. :-)
- RRu Lemer @Ru_Lemer
Hi Kitch! Thanks for your reply. I'm on that version, but the code still comes back with the same error message. Has the tag changed for AxElementArrayIndexedItem?
Christian Scheuer @chrscheuer2023-07-14 16:07:30.038Z
The path to read this information from the table needs to be changed. Your code fetching this info will need to be updated. I don't remember exactly how I fixed SF's internal functions to read memory location info, but you'd need to change these lines to work with the new UI:
table.children.forEach(function (item, i) { var num = item.children[0].children[0].title.value; var text = item.children[1].children[0].title.value; if (num === null || text === null) return; items.push({ num, text, }); });