Modify multiple folder aliases at the same time

I have a bunch of aliases set up for quick directory access in a project based structure. For example:

2d = P:\ProjectName\clips\renders\2d_renders
3d = P:\ProjectName\clips\renders\3d_renders
ref = P:\ProjectName\clips\references
as = P:\ProjectName\3D\assets

I basically have 20+ of those set up and when the project changes I would like to be able to change the "ProjectName" to be something else. Better yet, would be nice to have a button(s) that could switch between a few projects I need to go into and do work on. Usually when a new project starts and the old one is ramping down the likelihood of having to switch the aliases a few times in a day becomes higher.

You can do that with a button that runs the following commands. It will ask you for the project name and then create (or update) the aliases one-by-one.

@set name={dlgstring|Enter project name}
Favorites ALIAS=set NAME=2d PATH "P:\{$name}\clips\renders\2d_renders"
Favorites ALIAS=set NAME=3d PATH "P:\{$name}\clips\renders\3d_renders"
Favorites ALIAS=set NAME=ref PATH "P:\{$name}\clips\references"
Favorites ALIAS=set NAME=as PATH "P:\{$name}\3D\assets"

If you want to have a button that uses a fixed project name, just change the top line; for example:

@set name=Project Name

You could also allow selection from a number of projects like this:

@set name={dlgchoose|Select project|Project 1+Project 2+Project 3}

Here's a script command that will make things easier, by letting you define all the aliases in one place:

Drag that to Preferences / Toolbars / Scripts to install it, then click on the name of the script in the list (which will be underlined) to configure it, and double-click the aliases value to edit the list of aliases it creates:

That gives you a central place to define all the aliases you want the button to create.

  • Put the alias name before the = and the path after it.
  • Use %ProjectName% in the path for where you want the project names to be inserted.
  • Make sure there are no extra spaces at the start, end, or next to the =, as the script doesn't trim them.

Now you can make buttons/menus/hotkeys which run commands like this, to set all the aliases at once, specifying just the project name:

SetProjectAliases PROJECTNAME="My First Project"
SetProjectAliases PROJECTNAME="My Second Project"

and so on. Those are good for switching back & forth between projects you'll be using a lot.

You can also make a button which asks you to type an ad-hoc project name without having to edit a custom button for that project:

SetProjectAliases PROJECTNAME="{dlgstring|Enter Project Name:}"

Or, stealing from Jon's example above, you could make a button which shows a drop-down list of predefined project names:

SetProjectAliases PROJECTNAME="{dlgchoose|Select project|Project 1+Project 2+Project 3}"

(Compared to having a menu of buttons, the drop-down method is one extra click each time you change project, but easier to edit the whole list at once as a trade-off. Depends which you're likely to do more often.)

For reference, this is the script code in the download above:

// Called by Directory Opus to initialize the script
function OnInit(initData)
{ = "SetProjectAliases";
	initData.version = "1.0";
	initData.copyright = "(c) 2019 Leo Davidson";
	initData.url = "";
	initData.desc = "";
	initData.default_enable = true;
	initData.min_version = "12.10";

	var cmd = initData.AddCommand(); = "SetProjectAliases";
	cmd.method = "OnSetProjectAliases";
	cmd.desc = "";
	cmd.label = "SetProjectAliases";
	cmd.template = "PROJECTNAME";
	cmd.hide = false;
	cmd.icon = "script";

	// Default/example config.
	var v = DOpus.Create.Vector();
	initData.config.aliases = v;

// Implement the SetProjectAliases command
function OnSetProjectAliases(scriptCmdData)
	if (!scriptCmdData.func.args.got_arg.PROJECTNAME)

	var projectName = scriptCmdData.func.args.PROJECTNAME;
	if (projectName.length < 1)

	var cmd = scriptCmdData.func.command;
	cmd.deselect = false;

	var v = Script.config.aliases;
	if (v.count == 0)

	var anyLines = false;

	for(var i = 0; i < v.count; ++i)
		var aliasDefn = v(i);
		var name = aliasDefn.replace(/^([^=]+)=.+$/,'$1');
		var path = aliasDefn.replace(/^[^=]+=(.+)$/,'$1');

		if (name == aliasDefn || path == aliasDefn)

		path = path.replace(/%projectname%/ig,projectName);
		var cmdLine = 'Favorites ALIAS=set NAME="' + name + '" PATH="' + path + '"';
		anyLines = true;

	if (anyLines)

Amazing, I will give this a shot when I'm at the studio tomorrow.

This piece of code works for me in a button but the script example does not seem to function for some reason. I installed the script, edited the list of aliases I want and made a button with

SetProjectAliases NAME="{dlgstring|Enter Project Name:}"

yet nothing happens.

My mistake, it should be PROJECTNAME instead of NAME. I've corrected my earlier post.

That was it, thank you !

One more question regarding the "dlgchoose" command. Is there a mechanism for reading a directory, taking all the folder names in it and then creating a list of them that would then feed into the dlgchoose command ? I know how to do this in python but not sure how this would be done in this context.

Quick & easy way:

SetProjectAliases PROJECTNAME="{dlgfolder|Select project folder for aliases|P:\|expand|nopath}"

That will just pass the name of the selected folder, due to the nopath code at the end. You could remove nopath so it passes the full path to the folder, in which case you'd want to modify the script's config to not add P:\ at the start of each path itself. That way you aren't limited to selecting projects below a predefined starting point.

So should this produce a button that has a list of all the folders at the root of P:\ ?

I get a file requester but then all my aliases become P:\P:\_clips\2d, etc

Nevermind, I see what it's doing. This works. Thank you for all your help.

1 Like

The nopath code in the button should prevent that, and does here.

But, failing that, you can edit the script's config to change the list of aliases so the script isn't adding P:\ to the start of all of them.

This does what I want, only issue that came up is that I was getting a double slash after the project name. But I ended up modifying the alias path from obj=P:%ProjectName%\3D_Conversions\OBJ to obj=P:%ProjectName%3D_Conversions\OBJ

I assume the nopath expands to the names all ending with a backslash which is where the extra slash was coming from.

You could add |noterm as well to suppress the \, I think.

That works !