Hi,
I'm triggering the following script from a template that is on a surface. This surface has worked for quite some time, but is now throwing a "Command 'user:cl4axopv30003w6107vo4fx72:cl6ksxuqe000rpo10673lh9ia' not found".
This is the command that it should run:
var timesThruCounter = 0
sf.ui.proTools.appActivateMainWindow();
//Ensure Link Track and Edit Selection is ON
var wasLinked = sf.ui.proTools.getMenuItem('Options', 'Link Track and Edit Selection').isMenuChecked;
if (!wasLinked) {
sf.ui.proTools.menuClick({
menuPath: ["Options", "Link Track and Edit Selection"],
});
}
// --------------NEW----
// Make sure Channel Names is being shown.
sf.ui.proTools.mainWindow.popupButtons.whoseTitle.is('Clip List').first.popupMenuSelect({
menuPath: ["Show", "Channel Name"],
targetValue: "Enable"
});
// Turn off Scene&Take as it it's easier to get chanel name
sf.ui.proTools.mainWindow.popupButtons.whoseTitle.is("Clip List").first.popupMenuSelect({
menuPath: ["Show", "Scene and Take"],
targetValue: "Disable"
});
// Get Channel Names
const selectedClips = sf.ui.proTools.mainWindow.tables.whoseTitle.is('CLIPS').first.children.whoseRole.is("AXRow").allItems.map(row =>
row.children[1].children.first.value.value).filter(c => c.startsWith('Selected. ')).map(l =>
l.split("(")[1]).map(n => n.replace(/["\"]/g, '')).map(o => o.split(")")[0]);
alert("SelectedClips: " + selectedClips);
// Removes duplicate Channel Names and creates a new array set.
const finalChannelNames = [...new Set(selectedClips)];
const finalChannelNamesLength = finalChannelNames.length.toString();
// alert("Wait for finalChannelNames array")
log("Channel names: " + finalChannelNames);
alert("Channel names: " + "finalChannelNamesLength: " + finalChannelNamesLength);
///-----------OLD----
var numTrackCount = sf.ui.proTools.selectedTrackCount;
var orgTrackName = sf.ui.proTools.selectedTrackNames;
var numTrackCountSTR = String(numTrackCount);
var ReturnToTrackName = sf.ui.proTools.selectedTrackNames[0];
// alert("org track name: "+ReturnToTrackName);
if (numTrackCount > 1) {
sf.interaction.displayDialog({
prompt: 'Too many AAF tracks selected.',
buttons: ['OK'],
defaultButton: 'OK'
});
} else {
var ClpChName;
var clipNames;
var channelNames;
var ClipFullname;
// opens Clip List
sf.ui.proTools.menuClick({
menuPath: ["View", "Other Displays", "Clip List"],
targetValue: "Enable",
});
// Gets clip info from Clip List
let selectedClipRows = sf.ui.proTools.mainWindow.clipListView.getElements('AXSelectedRows');
let items = selectedClipRows.map((r, i) => {
let s = r.children.allItems[1].children.first.title.value;
let line2 = s.split('\n')[1];
ClpChName = line2.split(',').slice(-1)[0].trim().replace(/\)/g, '');
const ClipsTableNames = sf.ui.proTools.mainWindow.tables.whoseTitle.is('CLIPS').first;
// Get all selected clips
const selectedClips = ClipsTableNames.children.whoseRole.is("AXRow").allItems.map(row =>
row.children[1].children.first.value.value).filter(c => c.startsWith('Selected. '));
// Extract clip names
clipNames = selectedClips.map(c => c.split('"')[1]);
channelNames = selectedClips.map(c => c.split('(')[1].split(')')[0]);
// Displays info and prompt
// let tmpClipFullname = selectedClips;
// let ClipFullname = tmpClipFullname.concat("");
// let AllSelectedClipNames = clipNames.join('; ');
let AllSelectedChannelNames = channelNames.join('\n ');
alert("AllSelectedChannelNames: " + AllSelectedChannelNames)
sf.interaction.displayDialog({
prompt: 'Channel name(s):\n ' + AllSelectedChannelNames + '\n\n Clip name(s):\n ' + clipNames + '\n\n\nCopy selected clips to ' + destTrackName + '?',
buttons: ['Cancel', 'Yes'],
defaultButton: 'Yes',
giveUpAfterSeconds: 2
});
//Gets ending timecode
var SELECTIONlengthInTC = sf.ui.proTools.selectionGet().selectionEnd
//Counts # of clips
let clipsTable = sf.ui.proTools.mainWindow.tables.whoseTitle.is('CLIPS').first;
// var selectedClipCount = clipsTable.getElements("AXSelectedRows").allItems.length;
//Copy the current clip to the clipboard
sf.keyboard.press({ keys: 'cmd+c' });
//Mute the current clip
sf.keyboard.press({ keys: 'cmd+m' });
//Go to our target track
sf.ui.proTools.trackSelectByName({
deselectOthers: true,
names: [destTrackName]
});
// Waiting: gives ProTools time to select track
sf.wait({
intervalMs: 500,
});
//Check that destination track is empty
// var DESTclipsTable = sf.ui.proTools.mainWindow.tables.whoseTitle.is('CLIPS').first;
var DESTselectedClipCount = clipsTable.getElements("AXSelectedRows").allItems.length;
if (DESTselectedClipCount > 0) {
//Display thru AppleScript
sf.system.execAppleScript({
script: "display notification with title \"Did not copy.\" subtitle \"There is a clip in the way on the destination track\""
});
//Stop with no log()
throw 0;
}
//Go to our target track
sf.ui.proTools.trackSelectByName({
deselectOthers: true,
names: [destTrackName]
});
// Waiting: gives ProTools time to select track
sf.wait({
intervalMs: 500,
});
//Paste the clip to target track
sf.ui.proTools.menuClick({
menuPath: ['Edit', 'Paste']
});
// ///Go back to org track
// sf.ui.proTools.menuClick({
// menuPath: ['Edit', 'Restore Last Selection']
// });
// orgTrackName
//Go to our target track
sf.ui.proTools.trackSelectByName({
deselectOthers: true,
names: [ReturnToTrackName]
});
//Sets current time to ending timecode
sf.ui.proTools.selectionSetTimecode({
selectionStart: SELECTIONlengthInTC,
});
// Selects next clip
sf.keyboard.press({
keys: "ctrl+tab",
});
sf.ui.proTools.clipCenter();
//Increase times thru count +1
timesThruCounter = timesThruCounter + 1;
// alert('timesThruCounter = ' + timesThruCounter);
if (timesThruCounter = 1) {
//gets next clip's info
var endnumTrackCount = sf.ui.proTools.selectedTrackCount;
var endorgTrackName = sf.ui.proTools.selectedTrackNames;
var endnumTrackCountSTR = String(numTrackCount);
var endClpChName;
var endclipNames;
var endchannelNames;
var endClipFullname;
//new way to get Channel names:
// Get Channel Names
endClpChName = sf.ui.proTools.mainWindow.tables.whoseTitle.is('CLIPS').first.children.whoseRole.is("AXRow").allItems.map(row =>
row.children[1].children.first.value.value).filter(c => c.startsWith('Selected. ')).map(l =>
l.split("(")[1]).map(n => n.replace(/["\"]/g, '')).map(o => o.split(")")[0]);
alert("Next selected clip info:\n" + endClpChName);
throw 0
//old version of getting clips from Clips List
// // Gets clip info from Clip List
// let endselectedClipRows = sf.ui.proTools.mainWindow.clipListView.getElements('AXSelectedRows');
// let enditems = endselectedClipRows.map((r, i) => {
// let s = r.children.allItems[1].children.first.title.value;
// let line2 = s.split('\n')[1];
// endClpChName = line2.split(',').slice(-1)[0].trim().replace(/\)/g, '');
// const endClipsTableNames = sf.ui.proTools.mainWindow.tables.whoseTitle.is('CLIPS').first;
// // Get all selected clips
// const endselectedClips = endClipsTableNames.children.whoseRole.is("AXRow").allItems.map(row =>
// row.children[1].children.first.value.value).filter(c => c.startsWith('Selected. '));
// // Extract clip names
// endclipNames = endselectedClips.map(c => c.split('"')[1]);
// endchannelNames = endselectedClips.map(c => c.split('(')[1].split(')')[0]); //.slice(0,selectedClips.indexOf(')')); //.split(/\(/g)[1]);
// // Displays info and prompt
// let endtmpClipFullname = endselectedClips;//.slice(0)[1].trim().replace(/\)/g, '');
// let endClipFullname = endtmpClipFullname.concat("");
// let endAllSelectedClipNames = endclipNames.join('; ');
// let endAllSelectedChannelNames = endchannelNames.join('\n ');
// var clpbrdVAR = endAllSelectedClipNames + ': ' + endAllSelectedChannelNames;
// //Copy url to clipboard
// sf.clipboard.setText({ text: clpbrdVAR });
// //Display thru AppleScript
// sf.system.execAppleScript({
// script: "display notification (get the clipboard) with title \"Next selected clip info:\""
// });
})
throw 0;
}
// });
// }
I'm running on a 2015 MacBook Pro on OS: 10.15.7
SoundFlow version: Version 5.5.3 (5.5.3)
Any idea as to what has gone wrong?
Thanks!
- SSoundFlow Bot @soundflowbot
Thanks for contacting SoundFlow support.
Please note, that the best way to get help with a script, macro or other content installed from the Store or content that you've made yourself, is to select the script/macro, then click the red Need help button, and then click "Get help with this script or macro".
By using this method, we will get access to more information and so should be able to help you quicker.
You can read more about how this works here: bit.ly/sfscripthelpIf you're seeing an error that isn't related to scripts or macros, and you think this is a bug in SoundFlow, please file a Help/Issue bug report.
You can see how to do this by going to bit.ly/sfhelpissue - In reply toJohn_T⬆:Christian Scheuer @chrscheuer2024-01-08 11:20:33.896Z
Hi John,
As a troubleshooting step, try replacing the code in that script with just a single line to log something.
If the command doesn't compile, for whatever reason, you'd get the "command not found" error message. By replacing its contents you'll figure out if it's indeed compilation error, or something else.If you still need help, please follow the steps the SoundFlow Bot outlined so we have access to your log files
- JJohn T @John_T
Hi, thanks Christian.
I commented all script out and just put a var declaration and it seems to find it now.
I'm uploading thru the bot and the red Help button. I did get this: "There was an error uploading your feedback: null" error, so I don't know it worked?
- JJohn T @John_T
Hi,
I think I found an errant "}" that may have killed it.
The Help button threw that error and then beachballed at the "Thank you!" screen. Had to exit out of it.
Thanks!!