Open folder in file browser after Export Audio Mixdown option

Adding a checkbox in the dialog that would also allow to automatically open the folder where files are exported.
Surprised I could not find this feature,
it takes 15 minutes c++ coding :slight_smile:
The function that does that in a portable way on both mac and pc is in c++ is:

system(mixdownExportPath); // launch the system dependent interface for this folder

(Yes I know developers time estimates are always on the short side LOL)

1 Like

Indeed, but in the Media > Pool window, we can right-click on (one of) the audio file(s) created and there is a Show in explorer command available. Not exactly what you were expecting, as we have to open this window, but still…

Check this out:

Thanks to both of you for the feedback , I believe that we should not have extra clicks, i do that sometimes more than a dozen of times during the same day/night, so I would appreciate a popup window automatically showing. I mean seriously after all the great work they did there, this should take no time to add. I love that simple feature in Studio One and would really like to have it in Cubase too.

1 Like

Unzip these two files to this path (on PC)
C:\ProgramData\Steinberg\Audio Export Post Process Scripts

Open_Explorer.zip (573 Bytes)

It will give the new item “Open in Explorer” for the “After Export” option.
grafik

OK that is really great Thanks!

I fixed the script (just a typo there prevented it to work) and provided one attached here BTW that works now.

But do you think any non developer user can do that?

I’ll mark it as a solution, but still thinks users could benefit to have this script predefined and installed for them.
Thanks again Johnny!

Open_Explorerv2.zip (500 Bytes)

PS: Is there more doc about what’s scriptable aside from the midi surfaces ?

Sorry for that. I corrected it in my previous post as well. Thanks for pointing it out.

Unzip these two files to this path (on PC)
C:\ProgramData\Steinberg\Audio Export Post Process Scripts

Open_Explorer.zip (707 Bytes)

It will add the item “Open in Explorer” for the “After Export” option.
grafik

NOTE: I have localized the name of the function to all languages supported by Cubase except for Japanese and Chinese (apology to the population of these countries).
FURTHER NOTE: This function will open each created file in its own window if you export several files at once. I might look into this issue in the future.

@Johnny_Moneto another improvement and small contrib I’d like to suggest is to change RunOnce to true in the script
<RunOnce>true</RunOnce>
instead of false as it will only open once the explorer if you exported separate tracks…

But it did not work for me so far:
It seems that using this option only opens up the temp directory because it provide as a path the path of a temp xml descriptor file so when getting the corresponding path (%~dp1) it gets the temp folder instead of the mixdown folder…

2 Likes

Hi Fab,

yes, I am aware. This was discussed some years ago on this board already. A temp file gets created that needs to be parsed. That’s why I stayed away from RunOnce=True for now. I am looking into it. I haven’t used CMD or PowerShell so far to do this kind of stuff.
Do you got experience with this? You’d need to extract the characters inside the “Path” tag but delete everything after the last backslash.

Alternatively we could create small app that only launches explorer once and discards other requests if it is already open.

IMHO, the issue is possibly the design (but maybe we don’t know yet all that’ s possible in terms of available tags), as we should be able to specify what kind of output we are interested in the xml file (e.g. filters). Because running once is too limiting as is for now.

As an example, we could desire in some situations that the same script handles certain files as manytimes as there are files but other actions only once…

If you want to create the deluxe version, here are the challenges:

  1. if the user creates several files through Queue jobs
    (a) if all files are in the same folder => open folder window once
    (b) if files are in seperate folders => open all different folder windows
  2. if user creates several files through Cycle Markers => surpress the opening of several windows

@fese found a nice solution for case 1a and 2 using PowerShell. However, the user would need to allow PowerShell scripts to be run. That lowers the security status of that computer a bit and might not be feasible/comfortable for everybody.

I made a solution for 1a only so far using a CMD batch file. 1b is not feasible with my current solution. Not sure how 2 can be achieved.

My goal is to not have any executables involved as some users might not be allowed to use them on their system (in studios for example).

After all, I’m a developer too, so i quickly created a smart c++ console app that does what I needed.

Not only it detects if the window is already opened but also if it is will select it to show on top instead of reopening it (handy when your previous windows is buried below other ones since last time you exported).

Now if not present, it will launch explorer of course but also wait that the window is shown (otherwise code would be sometimes unreliable when multiple files are generated at once)…
Open_Explorer-fab.zip (76.1 KB)

Works a treat and app was trivial to code, so here’s the solution for you:
Enjoy! :slightly_smiling_face:

Here the quick (and not so dirty) cpp console app source code too :

#include <Windows.h>
#include <stdio.h>
#include <string.h>
#include "Shlwapi.h"

// Console app that launches an explorer window only if it is not already open, if it is it will show it to user as well instead of reopening.

bool FindExplorerWindowWithPath(const char* target_path)
{
	HWND hwnd = FindWindow("CabinetWClass", nullptr);
	char window_title[MAX_PATH];

	while (hwnd)
	{
		GetWindowText(hwnd, window_title, sizeof(window_title));
		if (strstr(window_title, target_path)) 
		{
			SetForegroundWindow(hwnd);
			return true;
		}
		hwnd = FindWindowEx(nullptr, hwnd, "CabinetWClass", nullptr);
	}
	return false;
}

int main(int argc, char* argv[])
{
	if (argc != 2)
	{
		printf("Usage: %s path\n", argv[0]);
		return 2;
	}

	char* path = argv[1];
	char target_path[MAX_PATH];
	if (!GetFullPathName(path, MAX_PATH, target_path, nullptr))
	{
		fprintf(stderr, "Error: %s is not a valid path.\n", path);
		return 3;
	}

	// Normalize input to always remove ending backslash and also being a dir
	if(!PathIsDirectory(target_path)) PathRemoveFileSpec(target_path);
	size_t  l = strlen(target_path);
	if (l > 1 && target_path[l - 1] == '\\') target_path[l - 1] = '\0';

	if (!FindExplorerWindowWithPath(target_path))
	{

		fprintf(stdout, "Opening explorer window for path: %s...\n", target_path);

		char command[1024];
		snprintf(command, sizeof command, "explorer \"%s\"", target_path);

		if (!system(command)) fprintf(stderr, "Error: failed to run explorer for path: %s\n", target_path);
		else
		{
			for (int i = 0; i < 20; i++)
			{
				Sleep(100);
				if (FindExplorerWindowWithPath(target_path)) break;
			}
		}
	}
	else
	{
		fprintf(stderr, "Explorer window for path: %s already exists...\n", target_path);
		return 1;

	}

	return 0;
}

Note: you need my new script too in the zip.

1 Like

is there a similar solution for mac?

On Mac a unix guru could certainly do that with a shell script, even if not as sophisticated as the custom app i developped for windows.

That said most of the C code should work (e.g. system() is portable) but I don’t know yet how to hook the windows detection on mac, If I had an M1 mac I could quickly figure and make more mac versions of my contribs though, so if anyone has an old M1 mac mini to get rid of, PM me :slight_smile: