Title
Import session data - how to navigate to protools template
What do you expect to happen when you run the script/macro?
I'm trying to build a macro that will open the import session data window, navigate to where my protools mix template is saved (documents folder), and then select it and import all data.
Where I'm getting stuck is figuring out how to have soundflow navigate to my template protools session file which is in my documents folder. How do I guid soundflow to fild my specific session file?
Thanks!
Are you seeing an error?
What happens when you run this script?
The import session data window opens correctly, but i dont know how to point it to the correct file. Generally the import session data window opens in a different location everytime also, so i need it to navigate specifically to where the file is located (in my documents folder)
How were you running this script?
I clicked the "Run Script" or "Run Macro" button in SoundFlow
How important is this issue to you?
3
Details
{ "inputExpected": "I'm trying to build a macro that will open the import session data window, navigate to where my protools mix template is saved (documents folder), and then select it and import all data.\n\nWhere I'm getting stuck is figuring out how to have soundflow navigate to my template protools session file which is in my documents folder. How do I guid soundflow to fild my specific session file?\n\nThanks!", "inputIsError": false, "inputWhatHappens": "The import session data window opens correctly, but i dont know how to point it to the correct file. Generally the import session data window opens in a different location everytime also, so i need it to navigate specifically to where the file is located (in my documents folder)", "inputHowRun": { "key": "-MpfwYA4I6GGlXgvp5j1", "title": "I clicked the \"Run Script\" or \"Run Macro\" button in SoundFlow" }, "inputImportance": 3, "inputTitle": "Import session data - how to navigate to protools template" }
Source
//Macro converted to script
sf.ui.proTools.menuClick({
menuPath: ["File","Import","Session Data..."],
});
sf.ui.proTools.windows.whoseTitle.is("Open").first.children.whoseRole.is("AXStaticText").whoseValue.is("Choose a file to import session data from").first.elementWaitFor();
Links
User UID: V1j0aAqXguStBYYHVLNaRpbeV4V2
Feedback Key: sffeedback:V1j0aAqXguStBYYHVLNaRpbeV4V2:-MvPMB-8bIuREhAWGtQU
- Raphael Sepulveda @raphaelsepulveda2022-02-08 18:42:19.610Z
Hey @yianniap,
This script should get you up to the Import Session Data window, all you have to do is provide the path to the template file where I've indicated in the first part of the script:
// You can copy the exact path to the clipboard by pressing cmd+opt+c while the session is selected in Finder const sessionFilePath = 'ENTER PATH TO SESSION HERE'; sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.menuClick({ menuPath: ['File', 'Import', 'Session Data...'] }); const openWin = sf.ui.proTools.windows.whoseTitle.is("Open").first; // Wait for the "Open" window to appear openWin.elementWaitFor(); // Open the "Go to the folder" sheet sf.keyboard.press({ keys: 'slash' }) // Wait for it appear openWin.sheets.first.elementWaitFor(); // Set the path to the session file openWin.sheets.first.comboBoxes.first.value.value = sessionFilePath; // Click 'Go' openWin.sheets.first.buttons.whoseTitle.is("Go").first.elementClick(); // Wait until sheet closes openWin.sheets.first.elementWaitFor({ waitType: 'Disappear' }); // Click 'Open' and wait for window to dissapear openWin.buttons.whoseTitle.is("Open").first.elementClick(); openWin.elementWaitFor({ waitType: 'Disappear' }); // Dismiss any confirmation dialogs, if any if (sf.ui.proTools.confirmationDialog.exists) { sf.ui.proTools.confirmationDialog.okButton.elementClick(); } // Wait for Import Session Data window sf.ui.proTools.windows.whoseTitle.is("Import Session Data").first.elementWaitFor();
- MMarek Romanowski @Marek_Romanowski
Hi Raphael,
I try to use this script, it's almost working for me... But I'm getting error - something wrong with Line 23 which is :
openWin.sheets.first.buttons.whoseTitle.is("Go").first.elementClick();This is my version of this script:
// You can copy the exact path to the clipboard by pressing cmd+opt+c while the session is selected in Finder
const sessionFilePath = '/Volumes/DAW/Pro Tools/_templates/mix AllTracks.ptx';sf.ui.proTools.appActivateMainWindow();
sf.ui.proTools.menuClick({ menuPath: ['File', 'Import', 'Session Data...'] });
const openWin = sf.ui.proTools.windows.whoseTitle.is("Open").first;
// Wait for the "Open" window to appear
openWin.elementWaitFor();// Open the "Go to the folder" sheet
sf.keyboard.press({ keys: 'slash' })// Wait for it appear
openWin.sheets.first.elementWaitFor();// Set the path to the session file
openWin.sheets.first.comboBoxes.first.value.value = sessionFilePath;// Click 'Go'
openWin.sheets.first.buttons.whoseTitle.is("Go").first.elementClick();// Wait until sheet closes
openWin.sheets.first.elementWaitFor({ waitType: 'Disappear' });// Click 'Open' and wait for window to dissapear
openWin.buttons.whoseTitle.is("Open").first.elementClick();
openWin.elementWaitFor({ waitType: 'Disappear' });// Dismiss any confirmation dialogs, if any
if (sf.ui.proTools.confirmationDialog.exists) {
sf.ui.proTools.confirmationDialog.okButton.elementClick();
}// Wait for Import Session Data window
sf.ui.proTools.windows.whoseTitle.is("Import Session Data").first.elementWaitFor();- OOwen Granich-Young @Owen_Granich_Young
What OS are you in Marek? The above script works for me in Mojave 10.14.6 -- but I recently built a whole tool kit of import tools that don't work in Big Sur at all -- I think because Apple decided to change entirely how the SHEETS window pops up. Perhaps this is a similar problem?
- MMarek Romanowski @Marek_Romanowski
Catalina 10.15.7 here ...
Raphael Sepulveda @raphaelsepulveda2022-04-25 20:27:07.686Z
Hey @Marek_Romanowski, mmm, that's strange. I'm on Catalina as well. Just tested it and still works on my end.
The error is that it fails to click on the Go To sheet's "Go" button. Does the sheet appear at all? (it's the pane that drops down to enter a path)
- OOwen Granich-Young @Owen_Granich_Young
@raphaelsepulveda the script I jacked from here had a bunch of 'try and try again' error catching. Wonder if this wants for that?
Raphael Sepulveda @raphaelsepulveda2022-04-25 22:19:53.685Z
@Marek_Romanowski, ah, I was able to reproduce the problem!
If I set the view on that window to "Columns"—as you have it on your screenshot—I get the same error. For some reason, having it on Columns is messing something up. All my Finder-like windows default to "List" view so that's why I've never seen this happen before on my end.
At the moment I wasn't able to determine the exact reason why this happens in this particular view, but if you replace line 23 with the following, you should be good:
openWin.sheets.first.buttons.whoseTitle.is("Go").first.elementClick({ asyncSwallow: true });
@Owen_Granich_Young, thanks for the assist throughout the thread!
- OOwen Granich-Young @Owen_Granich_Young
I'm just curious cuz i'm tying to get to the bottom of the Big Sur Problem.
- In reply toraphaelsepulveda⬆:MMarek Romanowski @Marek_Romanowski
Fantastic! Now it's working.
Thank you @raphaelsepulveda :)
- In reply toraphaelsepulveda⬆:RRafael Sánchez @Rafael_Sanchez
I tried it, but an error in line 11 appears. I'm working with Ventura 13.1.
Probably I'm doing something wrong because scripts and me are not friends.
This is the script adapted to my computer.
// You can copy the exact path to the clipboard by pressing cmd+opt+c while the session is selected in Finder
const sessionFilePath = '/Users/rafaelsanchezlopez/Desktop/Rafa Sánchez Mix Template V2.ptx';sf.ui.proTools.appActivateMainWindow();
sf.ui.proTools.menuClick({ menuPath: ['File', 'Import', 'Session Data...'] });
const openWin = sf.ui.proTools.windows.whoseTitle.is("Open").first;
// Wait for the "Open" window to appear
openWin.elementWaitFor();// Open the "Go to the folder" sheet
sf.keyboard.press({ keys: 'slash' })// Wait for it appear
openWin.sheets.first.elementWaitFor();// Set the path to the session file
openWin.sheets.first.comboBoxes.first.value.value = sessionFilePath;// Click 'Go'
openWin.sheets.first.buttons.whoseTitle.is("Go").first.elementClick();// Wait until sheet closes
openWin.sheets.first.elementWaitFor({ waitType: 'Disappear' });// Click 'Open' and wait for window to dissapear
openWin.buttons.whoseTitle.is("Open").first.elementClick();
openWin.elementWaitFor({ waitType: 'Disappear' });// Dismiss any confirmation dialogs, if any
if (sf.ui.proTools.confirmationDialog.exists) {
sf.ui.proTools.confirmationDialog.okButton.elementClick();
}// Wait for Import Session Data window
sf.ui.proTools.windows.whoseTitle.is("Import Session Data").first.elementWaitFor();Raphael Sepulveda @raphaelsepulveda2023-03-14 22:10:50.023Z
Hey @Rafael_Sanchez,
The macOS "Go To" sheet UI element changed from the time this script was written. Below I've adapted it to handle the new sheet—tested in Monterey, but I believe it's still the same for Ventura:
// You can copy the exact path to the clipboard by pressing cmd+opt+c while the session is selected in Finder const sessionFilePath = '/Users/rafaelsanchezlopez/Desktop/Rafa Sánchez Mix Template V2.ptx'; sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.menuClick({ menuPath: ['File', 'Import', 'Session Data...'] }); const openWin = sf.ui.proTools.windows.whoseTitle.is("Open").first; const openWinSheet = openWin.sheets.first; // Wait for the "Open" window to appear openWin.elementWaitFor(); // Open the "Go to the folder" sheet sf.keyboard.press({ keys: 'slash' }); // Wait for it appear openWinSheet.elementWaitFor(); // Set the path to the session file openWinSheet.textFields.first.value.value = sessionFilePath; sf.keyboard.press({ keys: 'return' }); // Wait until sheet closes openWinSheet.elementWaitFor({ waitType: 'Disappear' }); // Click 'Open' and wait for window to dissapear openWin.buttons.whoseTitle.is("Open").first.elementClick(); openWin.elementWaitFor({ waitType: 'Disappear' }); // Dismiss any confirmation dialogs, if any if (sf.ui.proTools.confirmationDialog.exists) { sf.ui.proTools.confirmationDialog.okButton.elementClick(); } // Wait for Import Session Data window sf.ui.proTools.windows.whoseTitle.is("Import Session Data").first.elementWaitFor();
- RRafael Sánchez @Rafael_Sanchez
I tried with it but it's not working I don't know why :(
Thanks!!- VVanessa Garde @Vanessa_Garde
Following on the great @raphaelsepulveda , on Monterey, the Open button doesn't seem recognised... So... in stead, modify lines 29-31 to:
With just "return" it'll do it. :-)
The rest it's the same! Have fun @Rafa_Sanchez !
// Click 'Open' and wait for window to dissapear sf.keyboard.press({ keys: 'return' }); // openWin.buttons.whoseTitle.is("Open").first.elementClick(); // openWin.elementWaitFor({ waitType: 'Disappear' });
- YIn reply toyianniap⬆:yianniap @yianniap
Awesome! Thanks so much for this, excited to give it a try
- CIn reply toyianniap⬆:Clay Blair @Clay_Blair
I tried this script but it takes too long.
It opens a separate dialog where i have to select the file folder. I might as well just do option-shift-i at that point. Id like to be able to import my whole template with one button with no mouse clicks required. Seems none of these scripts i have found can do that.
- SScott Robinson @Scott_Robinson
Hey @Clay_Blair good to see you here, don’t know if you remember me from when I recorded at your place with Jeoff before the fire. Anyway, if you’re still looking for this let me know!
- JJonathan Johnson @Jonathan_Johnson
Not Clay, But I'd be interested in this! Yes Please! would love to hit a button to open import session and then have a choice to pick what to inport from a master Template instead of a 'take all' situation.
- SScott Robinson @Scott_Robinson
Hey Jonathan, this should be pretty easy now, but I just want to understand clearly- you basically just want to automate opening up the import dialogue and selecting the template, and then you’d manually select what to import?
Coincidentally, I need to make something more like this for myself anyway!
- In reply toJonathan_Johnson⬆:SScott Robinson @Scott_Robinson
Try this. You’ll just need to change your template folder and name. Unfortunately I only know how to do this with key presses but it worked pretty consistently for me on quick testing. Maybe someone else knows a more reliable method to navigate the Open dialogue.
const templateFolder = "/Users/scottrobinson/Documents/Pro Tools/Session Templates/Scott/"; const templateName = "STR Mix - Mar 2025 v5 - High Latency.ptxt"; sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.invalidate(); sf.ui.proTools.menuClick({ menuPath: ["File","Import","Session Data..."], }); const win = sf.ui.proTools.windows.whoseTitle.is("Open").first.splitGroups.first.splitGroups.first.elementWaitFor({ waitType: "Appear" }, "Window didn't open").element; sf.keyboard.press({keys: "cmd+shift+g",}); sf.keyboard.press({keys: "backspace",}); sf.wait({ intervalMs: 100, }); sf.keyboard.type({text: templateFolder;}); sf.keyboard.press({keys: "return",}); sf.wait({ intervalMs: 100, }); sf.keyboard.type({text: templateName;}); sf.wait({ intervalMs: 100, }); sf.keyboard.press({keys: "return",});