Hello
I want to audition between the previous mix and the current mix.
I just need to be able to select a specific track and toggle the input of it, but please tell me how.
I could have had certain tracks selected.
function getGroupListItem(name) {
var groupList = sf.ui.proTools.mainWindow.tables.whoseTitle.contains('Group').first;
return groupList.childrenByRole("AXRow").allItems.map(function (r) {
return {
row: r,
selectBtn: r.childrenByRole("AXCell").first.children.first,
name: r.childrenByRole("AXCell").allItems[1].children.first.title.value.match(/^.+ - ([^(]+)/)[1].replace(/ $/, ''),
};
}).filter(function (r) { return r.name == name })[0];
}
var groupListItem = getGroupListItem("PrintMaster");
groupListItem.selectBtn.elementClick();
I don't know how to toggle the input from here.
I can see that I would prefer not to use the Shift+I method.
please help me.
- Yujiro Yonetsu @Yujiro_Yonetsu
I've tried and tried and tried, but it doesn't work. What is wrong with it?
function getGroupListItem(name) { var groupList = sf.ui.proTools.mainWindow.tables.whoseTitle.contains('Group').first; return groupList.childrenByRole("AXRow").allItems.map(function (r) { return { row: r, selectBtn: r.childrenByRole("AXCell").first.children.first, name: r.childrenByRole("AXCell").allItems[1].children.first.title.value.match(/^.+ - ([^(]+)/)[1].replace(/ $/, ''), }; }).filter(function (r) { return r.name == name })[0]; var groupListItem = getGroupListItem("PrintMaster"); groupListItem.selectBtn.elementClick(); var inputBtn = track.buttons.whoseTitle.is('TrackInput Monitor').first; inputBtn.elementClick(); } inputBtn("PrintMaster")
Christian Scheuer @chrscheuer2020-11-05 21:16:15.523Z
Hi Yujiro.
I can see you're using code that works with Groups. Is there any specific reason for that? From as far as I can see, all you want to do is to toggle the Input Monitor state of just one track, right?
This script here would toggle the Input Monitoring mode of the track with the name "PrintMaster":
function trackToggleInput(trackName) { var track = sf.ui.proTools.trackGetByName({ name: trackName }).track; var inputBtn = track.buttons.whoseTitle.is('TrackInput Monitor').first; inputBtn.elementClick(); } trackToggleInput('PrintMaster');
Yujiro Yonetsu @Yujiro_Yonetsu
Thanks for the script.
But I did so for a reason.
The name of the track to be printed changes every time because I want to include the name of the song.
We want to make it work with the group name so that it can be used commonly there.please help me
Christian Scheuer @chrscheuer2020-11-06 14:17:11.424Z
Can you clarify a bit more? So the group would have just one track, whose input monitor you want to toggle? Or does the group contain more than one track?
Yujiro Yonetsu @Yujiro_Yonetsu
Okay.
My Mix printed to one audio track.
All track out assigned to this track.
What I'm monitoring is this print track out.The name of the track name includes the title and version of the song.
ex.
Song01_Mix1.0Each time I work on a mix, the version is updated, and it accumulates in a playlist on the print track.
This script should come into play when I want to compare the sound of past versions of a mix with the current mix.
The input button on the print track can be toggled to make this happen.Since the track names in the print track change every time, we felt it was not a good idea to limit them in the script, so we chose to select them by group name.
If you can select a specific track in a name-independent way, that's fine too.(I've read
"Toggle input state of track by name" thread.
In my case, the truck isn't set to be at the far end, so I need a unique method.)Christian Scheuer @chrscheuer2020-11-07 12:36:04.374Z
Thank you so much for those details. We could still select them by group - but using a name search would make the script a lot faster and more robust.
For example - does the mix/master track always contain the text "_Mix"? If that's the case, then we can use that to find the track :)Yujiro Yonetsu @Yujiro_Yonetsu
Okay
I understand your comment.I make naming rule now.
Always my naming include "[Mix"
Can you tell me the script for that?And for my study, I'd like to know how to specify by the group name of my original purpose.
I think the difference will help us understand it better.Best regard
Christian Scheuer @chrscheuer2020-11-08 11:08:42.330Z2020-11-08 11:18:39.679Z
This should do it:
/**@param {string} partialTrackName */ function getFirstTrackContaining(partialTrackName) { return sf.ui.proTools.visibleTrackHeaders.filter(th => th.normalizedTrackName.includes(partialTrackName))[0]; } /**@param {AxPtTrackHeader} track */ function trackToggleInput(track) { var inputBtn = track.buttons.whoseTitle.is('TrackInput Monitor').first; inputBtn.elementClick({}, `Couldn't find track input button`); } function main() { let track = getFirstTrackContaining('[Mix'); if (!track) throw `Couldn't find a Mix track\nPlease make sure the track is visible`; trackToggleInput(track); } main();
The group script would need to select the track, like this (but could also be made to restore the track selection afterwards):
function getGroupListItem(groupName) { var groupList = sf.ui.proTools.mainWindow.tables.whoseTitle.contains('Group').first; if (!groupList.exists) throw `Couldn't find Group List`; return groupList.childrenByRole("AXRow").allItems.map(function (r) { return { row: r, selectBtn: r.childrenByRole("AXCell").first.children.first, name: r.childrenByRole("AXCell").allItems[1].children.first.title.value.match(/^.+ - ([^(]+)/)[1].replace(/ $/, ''), }; }).filter(function (r) { return r.name == groupName })[0]; } function selectTracksInGroup(groupName) { var groupListItem = getGroupListItem(groupName); if (!groupListItem) throw `Couldn't find group "${groupName}"`; groupListItem.selectBtn.elementClick({}, `Couldn't select tracks in group "${groupName}"`); } /**@param {AxPtTrackHeader} track */ function trackToggleInput(track) { var inputBtn = track.buttons.whoseTitle.is('TrackInput Monitor').first; inputBtn.elementClick({}, `Couldn't find track input button`); } function main() { selectTracksInGroup('PrintMaster'); trackToggleInput(sf.ui.proTools.selectedTrack); } main();
Yujiro Yonetsu @Yujiro_Yonetsu
Thank you so much!
I will compare and study the two methods you have taught me.Thank you!
- In reply tochrscheuer⬆:NNick Agee @Nick_Agee
Hey guys, I've been using this script for a while now to toggle input monitor on my print track (my print track name ends with Mix_v#). Its always worked great no matter what window view I'm on. But a few days ago I started to get this error message
Any ideas?? Thank you for your time
/**@param {string} partialTrackName */ function getFirstTrackContaining(partialTrackName) { return sf.ui.proTools.visibleTrackHeaders.filter(th => th.normalizedTrackName.includes(partialTrackName))[0]; } /**@param {AxPtTrackHeader} track */ function trackToggleInput(track) { var inputBtn = track.buttons.whoseTitle.is('TrackInput Monitor').first; inputBtn.elementClick({}, `Couldn't find track input button`); } function main() { let track = getFirstTrackContaining('Mix_v'); if (!track) throw `Couldn't find a Mix track\nPlease make sure the track is visible`; trackToggleInput(track); } main();```
Raphael Sepulveda @raphaelsepulveda2024-11-02 02:29:06.081Z
@Nick_Agee, if you upgraded to PT 2024.10 then you'll need to adjust Line 8 to this:
const inputBtn = track.buttons.whoseTitle.startsWith('Input monitoring ').first; // PT2024.10+
- NNick Agee @Nick_Agee
Perfect, that was it! Thank you!
- In reply toNick_Agee⬆:
Christian Scheuer @chrscheuer2024-11-04 10:30:05.652Z
Hi Nick,
I think the title of that button changed in PT 2024.10. Be sure to use the UI picker to get updated information about what the "TrackInput Monitor" button is called now.
Christian Scheuer @chrscheuer2024-11-04 10:30:16.075Z
Oops didn't see the existing replies, my bad :)
- In reply tochrscheuer⬆:
Mike Wax @mikewax
How would I make this work using the selected track instead of getting the track by name?
Thank you!Christian Scheuer @chrscheuer2022-09-23 00:49:03.989Z
Change
var track = sf.ui.proTools.trackGetByName({ name: trackName }).track;
tovar track = sf.ui.proTools.selectedTrack;
- In reply tochrscheuer⬆:
Jack Green @Jack_Green
Im having a problem with the above function after updating protools to 2024.10.2 and sound flow 5.10.0
function trackToggleInput(trackName) { var track = sf.ui.proTools.trackGetByName({ name: trackName }).track; var inputBtn = track.buttons.whoseTitle.is('TrackInput Monitor').first; inputBtn.elementClick(); } function sessionIM() { sf.ui.proTools.appActivateMainWindow(); let trackNames = sf.ui.proTools.trackNames; setGroupActiveOrInactive("IM/REC", true); if (trackNames.includes("_ST MIX")) { trackToggleInput("_ST MIX") } if (trackNames.includes("_LRMIX")) { trackToggleInput("_LRMIX") } } sessionIM();
Here is my version.
Im getting this error
ClickButtonAction requires UIElement (Mix Tool Functions: Line 64) Couldn't get item #0 as the array length was 0 - sf.ui.app('com.avid.ProTools').<unknown>.<unknown>.<unknown>.buttons.whoseTitle.is('TrackInput Monitor').first (AxElementArrayIndexedItem)
line 64 in this script (Which just holds lots of functions for use in various scripts) is...
inputBtn.elementClick();
Thanks in advance !
- In reply toJack_Green⬆:
Christian Scheuer @chrscheuer2025-01-07 15:45:54.216Z
I think it's likely the button is no longer called "TrackInput Monitor". Try using the UI picker in your script to verify its name is updated correctly.
Jack Green @Jack_Green
Thanks for getting back so quick.
Correct looks like the input path button definition has changed
sf.ui.proTools.trackGetByName({ name: '_LV Orch 5' }).track.buttons.whoseTitle.is("Input monitoring disabled").first as an example
Or
sf.ui.proTools.trackGetByName({ name: '_51MIX' }).track.buttons.whoseTitle.is("Input monitoring enabled").first
I'll work on a fix Tomorrow. I think I have an idea (if someone else doesn't beat me to it!)
Jack Green @Jack_Green
Managed to find 20 minutes. Here's what I got. I imagine someone will be along soon todo the same thing is half the lines ! haha
/** * @param {string} trackName * @param {"On"|"Off"|"Toggle"} value */ function trackToggleInput(trackName, value) { var track = sf.ui.proTools.trackGetByName({ name: trackName }).track; var inputBtn = undefined if (track.buttons.whoseTitle.is("Input monitoring enabled").first.exists) inputBtn = track.buttons.whoseTitle.is("Input monitoring enabled").first if (track.buttons.whoseTitle.is("Input monitoring disabled").first.exists) inputBtn = track.buttons.whoseTitle.is("Input monitoring disabled").first if (value == "Toggle") inputBtn.elementClick(); if (value == "On" && track.buttons.whoseTitle.is("Input monitoring disabled").first.exists) inputBtn.elementClick(); if (value =="Off" && track.buttons.whoseTitle.is("Input monitoring enabled").first.exists) inputBtn.elementClick(); }
Allows you to toggle or set as on or off.
Hope this helps someone.
Jack
Hors Piste @Hors_Piste
is there any way to choose to always toggle the first OR the last track of a session ?
I used to use this script but it doesn't work anymore...
/** * @param {string} trackName * @param {"On"|"Off"|"Toggle"} value */ function trackToggleInput(trackName, value) { var track = sf.ui.proTools.trackGetByName({ name: trackName }).track; var inputBtn = undefined if (track.buttons.whoseTitle.is("Input monitoring enabled").first.exists) inputBtn = track.buttons.whoseTitle.is("Input monitoring enabled").first if (track.buttons.whoseTitle.is("Input monitoring disabled").first.exists) inputBtn = track.buttons.whoseTitle.is("Input monitoring disabled").first if (value == "Toggle") inputBtn.elementClick(); if (value == "On" && track.buttons.whoseTitle.is("Input monitoring disabled").first.exists) inputBtn.elementClick(); if (value =="Off" && track.buttons.whoseTitle.is("Input monitoring enabled").first.exists) inputBtn.elementClick(); }```
- CIn reply toYujiro_Yonetsu⬆:Charles-Émile Beaudin @Charles_Emile_Beaudi
You could select that track by the input name this one will always stays.
- SIn reply toYujiro_Yonetsu⬆:Sebastian @Sebastian
Hi,
is there a fix to this scrip, now that the name of Input Monitoring seems to have changed?
Thanks for the help.Best
Sebastiansf.ui.proTools.selectedTrack.buttons.whoseTitle.is("Input monitoring disabled").first function toggleInput(trackName) { var track = sf.ui.proTools.invalidate().trackGetByName({ name: trackName, makeVisible: true, }).track; var inputBtn = track.buttons.whoseTitle.is('TrackInput Monitor').first; inputBtn.elementClick(); } function toggleInputOfLastTrack() { var lastTrackName = sf.ui.proTools.trackNames.slice(-1)[0]; toggleInput(lastTrackName); } toggleInputOfLastTrack();
Hors Piste @Hors_Piste
it would be awesome