Pro tools 2023.12 new memory locations window - getMemoryLocations
Hello everyone,
The new memory locations window for pro tools 2023.12 can be read with sf.proTools.memoryLocationsFetch().collection['List']
but we wont get the correct information.
Here's a function to replace this command. I tried to keep the same object key names as we had before so it should be easy to replace it.
You might still need to change memLoc.name
to memLoc['Name']
for example. So the object key is correct.
Also I removed the "Selected." from the values of the selected memLoc and added isSelected
to the object.
Happy holidays to all.
/**
* Retrieves a list of memory locations.
*
* @function
* @returns {Array<Object>} An array of objects representing memory locations.
* @property {boolean} isSelected - Indicates whether the memory location is selected.
* @property {string} Sharing Merging
* @property {string} Active Location
* @property {string} Number
* @property {string} Name
* @property {string} Track Name
* @property {string} Marker View filter
* @property {string} Selection Memory Location View filter
* @property {string} Zoom Settings View filter
* @property {string} Pre/Post-Roll View filter
* @property {string} Show/Hide View filter
* @property {string} Track Heights View filter
* @property {string} Active Groups View filter
* @property {string} Window Configuration filter
* @property {string} Venue Snapshot filter
* @property {string} MainCounterValue
* @property {string} Sub Counter
* @property {string} Comments
*/
function getMemoryLocationsList() {
let memLocList = []
sf.ui.proTools.memoryLocationsEnsureWindow({
action: () => {
const memLocWin = sf.ui.proTools.memoryLocationsWindow.tables.whoseTitle.is("Memory Locations")
const memLocColumns = memLocWin.first.children.whoseRole.is("AXColumn").first.children.whoseRole.is("AXRow").first.children.whoseRole.is("AXCell").map(mem =>
mem.children.whoseRole.is("AXStaticText").first.title.value
.replace("Numeration", "Number")
.replace("Marker Name", "Name")
.replace("Main Counter", "MainCounterValue")
);
memLocWin.allItems[1].children.whoseRole.is("AXRow").map(r => {
let obj = {};
r.children.whoseRole.is("AXCell").map((cell, i) => {
obj["isSelected"] = false
const cellValue = cell.children.whoseRole.is("AXStaticText").first.value.value
if (cellValue.startsWith("Selected. ")) {
obj["isSelected"] = true
}
obj[memLocColumns[i]] = cellValue.replace("Selected. ", "")
})
memLocList.push(obj)
})
},
restoreWindowOpenState: true
})
return memLocList
};
- JJohn York @John_York
Hi Samuel
Complete novice re the coding
Do I create a new Script and then Copy and Paste this script into it - and give that script a Keyboard Trigger?
No success so far - the Search Memory Locations window does not come up - even if I run the Script from the SF App
Best regards
John
samuel henriques @samuel_henriques
Hello John,
This is meant to grab the memory location list so you can use the data for some script.
If you want to see how it looks like, addlet memLocList = getMemoryLocationsList() log(memLocList)
after what you pasted, and you can see it in the SF log
- JJohn York @John_York
Hi Samuel
No result
I think what I want is not what you are describing for this script
I am looking for bringing up the SF window with all the Marker names in - and then typing the name wanted in the top left to search all Markers with that word in. So I can click on the marker name I want - then PT jumps to that MarkerThis got broken a few days ago when I installed the latest PT 2023.12
Is this what your script is about?
Kind regards
John
samuel henriques @samuel_henriques
Hey John,
I'm sorry for the confusion.
I know what you mean, the built in search window, and I can confirm SoundFlow's Christian is working to fix it and hopefully will be released if a few days.I the mean time, here's a simple script to open pro tools memory locations window and focus it so you can start typing to filter memory locations.
sf.ui.proTools.memoryLocationsEnsureWindow({ action: () => { sf.ui.proTools.memoryLocationsWindow.windowFocusClick() } })
Or you can just use pt's shortcut ⌘5
Hope it helps a bit.- PPierre van Caloen @Pierre_van_Caloen
Hi Samuel,
Thanks for the script.
That should work but have to rewrite a few scripts.Anyone knows if memoryLocationsFetch() will be fixed? @chrscheuer?
MainCounterValue is empty or "Marker Ruler" with 2023.12 and 5.5.4
so you can't filter the array to get the marker at current cursor position.13.01.2024 15:01:33.65 [Backend]: [LOG] Name -> School Gang
[LOG] MarkerTrack -> Marker Ruler
[LOG] MainCounterValue -> Marker Ruler
[LOG] StartTime -> null
[LOG] EndTime -> null
[LOG] StartTimeInSamples -> 0Regards,
PierreDustin Harris @Dustin_Harris
Since you're on 2023.12, give this a shot?
const memoryLocations = sf.app.proTools.memoryLocations.invalidate().allItems.map(m => { let mappedProps = {}; for (let prop in m) { const itemsToSkip = ["Parent", "FriendlyNodeName", "SupportsAutoUpdate",] if (!itemsToSkip.includes(prop)) { const lowerCasePropName = prop.slice(0,1).toLowerCase() + prop.slice(1); mappedProps[lowerCasePropName] = m[prop]; } } return mappedProps; }) log(memoryLocations);
- OOwen Granich-Young @Owen_Granich_Young
Much more elegant than the brute force approach I was trying, I sure wish it would tell us what color the marker was too.
- GIn reply tosamuel_henriques⬆:George Hinson @George_Hinson
Hi @samuel_henriques ,
A novice here, I am trying to open the memory location at the start of a selection and copy the name but I'm struggling to work out a way to do so, any help would be much appreciated,
All the best,George
samuel henriques @samuel_henriques
Hello George,
To get selection first memory location name, you can use:
const memoryLocations = sf.app.proTools.memoryLocations.invalidate().allItems.map(m => { let mappedProps = {}; for (let prop in m) { const itemsToSkip = ["Parent", "FriendlyNodeName", "SupportsAutoUpdate",] if (!itemsToSkip.includes(prop)) { const lowerCasePropName = prop.slice(0, 1).toLowerCase() + prop.slice(1); mappedProps[lowerCasePropName] = m[prop]; } } return mappedProps; }) const { inTime, outTime } = sf.app.proTools.getTimelineSelection({ timeScale: "Samples" }); const selectionMemLocs = memoryLocations.filter(ml => ml.startTimeInSamples >= inTime && ml.startTimeInSamples <= outTime); const firstMemLocInSelectionName = selectionMemLocs[0] && selectionMemLocs[0].name log(firstMemLocInSelectionName)
- GGeorge Hinson @George_Hinson
Hi Samuuel, thank you so much for this! Do you know if there is a way I can then copy the name from the script log? Thanks so much,
All the best,George
samuel henriques @samuel_henriques
hello George,
If you want to set the firstMemLocInSelectionName in the clipboard, so you can paste it somewhere else, you can addif (firstMemLocInSelectionName) { sf.clipboard.setText({ text: firstMemLocInSelectionName }) }
- GGeorge Hinson @George_Hinson
Thanks so much Samuel! This is great I'm creating a code to copy the memory location name and bounce a mix with that name and I've been stuck getting the memory name for ages so thank you :)
samuel henriques @samuel_henriques
here's a good start for you, add after line 22, the log you can delete.
sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.menuClick({ menuPath: ['File', 'Bounce Mix...'] }); const bounceMixWindow = sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first bounceMixWindow.elementWaitFor(); bounceMixWindow.textFields.first.elementSetTextFieldWithAreaValue({ value: firstMemLocInSelectionName })
- OIn reply tosamuel_henriques⬆:Owen Granich-Young @Owen_Granich_Young
This is awesome man, Is there any way you could add color detection to this?