How do you pass a file path in an open file dialog with SFX/DAW commands?
Here is a Save / SFX command:
sf.ui.useSfx();
sf.ui.proTools.menuClick({
menuPath: ['File', 'Save Session Copy In...'],
});
const okButton = sf.ui.proTools.windows.whoseTitle.is("Save Copy In...").first.buttons.whoseTitle.is("OK").first;
okButton.elementWaitFor();
okButton.elementClick({
filePaths: ['/Users/chr/.../copysave.ptx']
});
The path is passed when the OK button is clicked.
However, in an Open dialog the "Open" button is greyed out and cannot be pressed because nothing is selected in the file selector.
How do you dismiss the open window and pass the filePath?
There's no example in the SFX documentation.
Linked from:
In reply toChris_Shaw⬆:Kitch Membery @Kitch2025-12-01 20:12:07.569ZThis works for me @Chris_Shaw,
- Can you share the exact code you are using? (Or are you using the exact script above)?
- Make sure you have set the
filepathcorrectly. - Make sure that you have customized a checkbox in the "Save Copy In..." window, or you'll get an error dialog displayed.
This error...

- OOwen Granich-Young @Owen_Granich_Young
Whoa you're doing it on the OK click huh? This is working for me. At least it had been unless it was changed in latest.
I always need selected tracks and timeline range though, haven't explored the full Save Session Copy In version.
@Matt_Friedman has been working through a lot of these, I based my code on his.
function exportSelectedTracks(path, name) { if (!sf.ui.proTools.selectedTrackCount) { return } const savePath = `${path}/${name}`; sf.ui.proTools.sfx.dawCommands.getByUniquePersistedName("ExportSelectedTracksAsNewSession").menuItem.elementClick({ filePaths: [savePath] }); const win = sf.ui.proTools.windows.whoseTitle.is("Save Copy In...").first; win.elementWaitFor(); ['Audio Files', 'Convert to Specified Format', 'Selected Timeline Range Only'].forEach(title => { win.checkBoxes.whoseTitle.is(title).first.checkboxSet({ targetValue: "Enable" }); }); win.buttons.whoseTitle.is("OK").first.elementClick(); win.elementWaitFor({ waitType: "Disappear" }); } exportSelectedTracks(`${sessionParentPath}/Fixes`, fixName);
Kitch Membery @Kitch2025-12-01 21:20:28.032ZYep. - Whoa, you're doing it on the OK click huh?
I feel like you were attempting to do this with another dialog from another thread... The same principle may appy for that also.
- OOwen Granich-Young @Owen_Granich_Young
Ohh the Export Clips as files right? I actually finally solved that with SDK, because I was renaming the file in the flow of the script, even invalidating after was breaking it. I just stopped renaming the file and it fixed everything :P
Kitch Membery @Kitch2025-12-01 21:50:33.263ZYay... Win!
- In reply toKitch⬆:
Matt Friedman @Matt_FriedmanSo my take on this, although it's not explicity stated in the new Docs here: https://soundflow.org/docs/scripting/adapting-scripts-for-sfx#open-and-save-dialogs
When the menu command immediately invokes a MacOS/Finder dialog, we use filePaths on that menu click command:
Import Midi, Import Session Data, Import Video, etc...
sf.ui.proTools.menuClick({ menuPath: ['File', 'Import', 'MIDI...'], filePaths: ['/Users/chr/.../midifile.mid'], });When the menu command immediately invokes a Pro Tools dialog, while using filePaths on the menu click does work, it's better if we follow the docs and use the filePaths on the button click that closes the Pro Tools dialog and then leads us to a MacOS dialog:
Export Selected Tracks, Save Session Copy In, etc...
sf.ui.proTools.menuClick({ menuPath: ['File', 'Export', 'Selected Tracks as New Session...'] }); const win = sf.ui.proTools.windows.whoseTitle.is("Save Copy In...").first; win.elementWaitFor(); // do some stuff in the dialog window, check some boxes win.buttons.whoseTitle.is("OK").first.elementClick({ filePaths: ['/Users/chr/.../copysave.ptx'], });
Kitch Membery @Kitch2025-12-03 22:15:15.239ZYes, I plan on adding more information on this topic to the documentation soon, as it is lacking for sure. :-)
- In reply toOwen_Granich_Young⬆:
Matt Friedman @Matt_FriedmanI have found you need to add the
.ptxto the name of what you are saving. For example, I have a version that looks like this:This is from a larger function library of mine that has SFX and non-SFX fallbacks, so its complicated, but:
sf.ui.proTools.menuClick({ menuPath: ['File', 'Export', 'Selected Tracks as New Session...'], ...(sf.ui.proTools.isSfxApplication && { filePaths: [`${newSessionPath}.ptx`] }), });Having the
.ptxworks in there, whether your end result is just a session file being exported, or a whole session folder (because audio files are being exported with the session)