Desired Workflow
Press the shortcut CMD+ALT+SHIFT+F and finder will navigate to the current session folder
Question
The error I'm getting is that there's a:
TypeError: Cannot read property 'split' of undefined (Navigate to Current Session Folder line 22)
So it appears to be an issue with line 22 in the code.
Command Info
ID: user:ck1zg7d5g00029h10rsur9c6b:ckgasgpne0000gd10pi42dwqr
Name: Navigate to Current Session Folder
Source
var logic = sf.ui.app('com.apple.logic10');
function navigateToInDialog(path) {
//Get a reference to the focused window in the frontmost app:
var win = sf.ui.frontmostApp.focusedWindow;
//Open the Go to... sheet
sf.keyboard.type({ text: '/' });
//Wait for the sheet to appear
var sheet = win.sheets.first.elementWaitFor({ timeout: 500 }, 'Could not find "Go to" sheet in the Save/Open dialog').element;
//Set the value of the combo box
sheet.comboBoxes.first.value.value = path;
//Press OK
sheet.buttons.whoseTitle.is('Go').first.elementClick({}, 'Could not click "Go"');
//Wait for sheet to close
win.sheets.first.elementWaitFor({ waitForNoElement: true, timeout: 500 }, '"Go to" sheet didn\'t close in time');
}
//var folderPath = sf.ui.proTools.mainWindow.sessionPath.split('/').slice(0, -1).join('/');
var folderPath = logic.mainWindow.sessionPath.split('/').slice(0, -1).join('/');
if (sf.ui.frontmostApp.focusedWindow.title.value.match(/open|import/i)) {
navigateToInDialog(folderPath);
} else {
sf.system.exec({ commandLine: 'open "' + folderPath + '"' });
sf.ui.finder.appActivateMainWindow();
sf.ui.finder.windows.first.elementRaise();
}
Links
User UID: EF59CtElieQvuJf45Plcbt1vTkq1
Feedback Key: sffeedback:EF59CtElieQvuJf45Plcbt1vTkq1:-MJgEqZTU4V3ii2X6Gwg
Linked from:
- Christian Scheuer @chrscheuer2020-10-15 20:09:07.189Z
Hi Graham
I'm not sure that you can use the "sessionPath" variable in Logic - it was designed for Pro Tools.
- GGraham Archer @Graham_Archer
Hey Christian,
Thanks for replying. Ah ok that'll be why it doesn't work then! If it's an easy thing to introduce in a future version of Sound Flow that would be great as I use the same command loads in Pro Tools and find it to be such a time saver.
I hope you're well.
g
Christian Scheuer @chrscheuer2020-10-15 21:20:47.759Z
You may be able to use
mainWindow.getString('AXDocument')
- I'm not entirely sure if Logic has this functionality or not. Unfortunately, I don't have Logic on my current machine so can't check.
@Kitch did you ever have something working with Logic and its current open session path?Kitch Membery @Kitch2020-10-15 21:38:41.007Z
Hi @Graham_Archer,
I'll check it out. It should be easy enough :-)
- In reply tochrscheuer⬆:
Kitch Membery @Kitch2020-10-15 22:06:12.702Z
@Graham_Archer... Thanks for asking this one, Now I can store this for my future logic scripts :-)
const logic = sf.ui.app('com.apple.logic10'); const filePath = logic.mainWindow.getString("AXDocument").slice(7, -1); const folderPath = filePath.split('/').slice(0, -1).join('/'); const sessionName = filePath.split('/').slice(-1)[0].split('.logicx')[0]; const fileExtension = '.logicx'; log(`${folderPath}/${sessionName}${fileExtension}`);
Rock on!
Kitch Membery @Kitch2020-10-15 22:21:49.079Z
Oh... And this will open the Session Folder ;
const logic = sf.ui.app('com.apple.logic10'); const filePath = logic.mainWindow.getString("AXDocument").slice(7, -1); const folderPath = filePath.split('/').slice(0, -1).join('/'); const sessionName = filePath.split('/').slice(-1)[0].split('.logicx')[0]; const fileExtension = '.logicx'; log(`${folderPath}/${sessionName}${fileExtension}`); //Open current Logic Pro X session folder in Finder sf.directory.open({ path: 'file://' + folderPath, });
- GGraham Archer @Graham_Archer
@Kitch You total legend! Thanks so much - I find it such a useful shortcut when grabbing a bounce etc. I hope others find it useful too.
g
Kitch Membery @Kitch2020-10-15 22:39:25.251Z
My pleasure mate!
FYI This code will open the "Bounces" folder :-)
//Open Current Logic Pro X Session Bounce Folder sf.directory.open({ path: 'file://' + folderPath + '/Bounces/', });
- In reply toKitch⬆:OOscar Fogelstrom @Oscar_Fogelstrom
Is there a way to open a "recent" location too? i.e. I often bounce straight to Dropbox and would like to go there after a bounce to send files
- OOscar Fogelstrom @Oscar_Fogelstrom
Kitch Membery @Kitch2021-04-10 18:53:35.962Z
Hi @Oscar_Fogelstrom ,
Can you describe how you would find out the recent location manually?
When bouncing are you using a script to choose the destination folder or are you bouncing manually?
Rock on!
- OOscar Fogelstrom @Oscar_Fogelstrom
Hi @Kitch !
Yeah so, maybe I was a bit unclear.
Manually I would just go to the relevant dropbox location and copy the dropbox link and add to an email.
I am not using a script for bouncing at the moment.
(So my thinking was: Since I always want to do this right after bouncing, maybe there is a way to "get" the latest folder (adress) that I used, either from Logic or Finder)Kitch Membery @Kitch2021-04-11 08:23:42.124Z
Ahh, yeah getting dropbox links is way complex and requires an using a rest API. I'm not sure I can help you out with that one right now.
Collecting the latest bounce folder address at the time of bouncing and storeing it as a global variable would for sure be the best way to go.
For now, here is the method you would use to open the dropbox folder;
sf.directory.open({ path:'/Users/yourUserName/Dropbox/' });
Rock on!
- OOscar Fogelstrom @Oscar_Fogelstrom
Awesome, thanks!
- In reply toKitch⬆:OOscar Fogelstrom @Oscar_Fogelstrom
Ok, so another quick question. I realize this might be in the documentation somewhere, but:
How do I combine actions and scripts in a package?Kitch Membery @Kitch2021-04-11 19:59:58.690Z
If possible, It would be great if you could ask this question in a separate thread as it does not seem to relate to this post's topic. Also if you could provide a bit more information in the new post about what you are trying to achieve that would be helpful.
Rock on.
- OOscar Fogelstrom @Oscar_Fogelstrom
will do, thanks!
- In reply toKitch⬆:AAndrew Skipper @Andrew_Skipper
Awesome @Kitch this is sooooo useful
- In reply toKitch⬆:AAndrew Sherman @Andrew_Sherman
This looks like a fantastic script. @Kitch is there any way of doing the same thing but for other applications as well? I'm trying to set up something similar that uses Ableton, Premiere, After Effects etc, but I'm getting stuck after replacing the app ID and file extension.
Kitch Membery @Kitch2021-04-26 11:13:15.560Z
Hi @Andrew_Sherman,
I don't have Ableton or After Effects, but for Premiere, this should work, however, I have not tested it thoroughly. :-/
const app = sf.ui.app("com.adobe.PremierePro.14") const mainWindow = app.windows.whoseTitle.contains(".prproj").first const sessionDirectoryPath = '/' + mainWindow.title.invalidate().value.replace(/( \*)$/, '').split('/').slice(0, -1).join('/'); sf.directory.open({ path: `${sessionDirectoryPath}` });
- AAndrew Sherman @Andrew_Sherman
Ooh this is like magic @Kitch. Soundflow never ceases to amaze me. This is going to be so useful. Thank you.
- AAndrew Sherman @Andrew_Sherman
@Kitch I'm making some progress on doing a multi-app version of this script, however I'm running into a few roadblocks. Would you have any tips on what I might do if the title of the window is too long (and truncated as a result - making it unclear how to get the path for the filename?
This is how the title of one of my example files shows in the After Effects window:
After Effects 2021 - /Users/andrewsherman/M ... ndrew Sherman/_Make Perceive/_Work/Flipdish/After Effects
And this is the actual path:
/Users/andrewsherman/Make Perceive Dropbox/Andrew Sherman/_Make Perceive/_Work/Flipdish/After Effects/
We need the path in order to reveal the parent folder. I've figured out how to remove the first part of the title, but I'm getting stuck as the path is not complete.
Kitch Membery @Kitch2021-05-10 17:56:48.681Z
Ahh yeah, that's a shame.
I'll have to see if I can download a trial version of After Effects later this week to see if I can figure it out. You might find that you can assign a shortcut within After Effects to reveal the project in the finder. If a shortcut exists for it it will probably be called something like "Reveal in Finder".
Let me know if you have any success with that :-)
Rock on!
- AAndrew Sherman @Andrew_Sherman
Hi Kitch, leave it with me for now; no need to go to the trouble of downloading a trial! I was looking at also doing this with other applications and I see Ableton doesn't use the pathname in the window name, so that further complicates things for my own use anyway.
I'm thinking of taking a different approach where I first use a trigger to set the "current project" in Finder and then simply open that whenever I need it. I think I know how to script that. But thanks anyway!
Kitch Membery @Kitch2021-05-10 18:06:00.354Z
Sounds good mate. Keep me posted :-)
- In reply toGraham_Archer⬆:Kitch Membery @Kitch2024-03-13 23:23:39.688Z
Hi @Graham_Archer & @Andrew_Skipper
I just thought I'd give you a heads up in case you were not aware, recently we added an Official Logic Pro package to SoundFlow that includes, Plugin, Instrument, MIDI FX, and Send loaders + much more. The package is available in the SoundFlow Store and requires Logic Pro 10.8 and above, and SoundFlow 5.7.0.
If you're interested, we'll be holding a webinar tomorrow Thursday 14th March at 11 am PST. If you are interested, be sure to register at the following link:
https://soundflow.org/events/2024-03-logic-pro-webinar
I hope you can attend. :-)- GGraham Archer @Graham_Archer
Hey @Kitch I'm sorry I missed this, I was in a session at the time. I'm really looking forward to exploring the new Logic Pro Package - great work. Please say thank you to the whole team.
g