Command to Edit folder aliases

Some aliases are temp used, change them in preference is not so quick.

For reference, you can add an alias via command:

Favorites ADD=alias NAME="MyTempAlias" PATH="C:\"

But that won't let you overwrite or edit an alias that already exists.

For that kind of thing, using variables might be a better solution, as you can change those in commands and refer to them in a very similar way to aliases.

For scripting: Vars

For everything else: @set to set variables and {$var} to refer to them.

1 Like

I use this to set a glob variable@set glob!:nodirs={sourcepath}
butGo {$nodirs} FOLDERCONTENT=nodirsdoesn't have any effect.

I noticed that, folderaliases are stored in a folderaliases.oxc file with XML format, if there are some CLI XML tool could detect aliases' name and delete it will be OK.

Now I have finish it, anybody who need delete some alias could use this to create a button with MS-DOS command
Such as delete the "WorkDir" alias below. you should chang the path of folderaliases.oxc to yours.

@runmode hide
powershell "((gc 'C:\Users\scmay\AppData\Roaming\GPSoftware\Directory Opus\ConfigFiles\folderaliases.oxc') -join \"`r`n\") -replace '<path label=\"WorkDir\">[\s\S]+?<\/path>'|out-file 'C:\Users\scmay\AppData\Roaming\GPSoftware\Directory Opus\ConfigFiles\folderaliases.oxc'"

We'll add a command to allow aliases to be modified and deleted in the next version. (Note that scripts already allow this).

I had a play with the Scripting Alias, I could not quite get the Add, update, and delete working together. Specifically when you should and should not call DOpus.aliases.Update();.

To Add a new Folder Alias call the DOpus.aliases.Add() method

DOpus.aliases.Add(name, path);
//Dont call DOpus.aliases.Update() after add for new or it errors

To Delete a Folder Alias call the DOpus.aliases.Delete() method

DOpus.aliases.Delete(name);
//Dont call DOpus.aliases.Update() after delete or it errors

To Update an existing Folder Alias call DOpus.aliases.Add() method, and then DOpus.aliases.Update().

DOpus.aliases.Add(name, path);
//Must call Update or the scripts cached copy of the 
DOpus.aliases.Update();

Once you call DOpus.aliases.Update(), making any calls to Add, update, or delete will cause this error Object doesn't support this property or method (0x800a01b6).

My plan was to create a dial for managing the Aliases.

ManageFolderAliases.osp (32.5 KB)

dialog
Button to display the dialog

<?xml version="1.0"?>
<button backcol="none" display="both" textcol="none">
	<label>Alias</label>
	<tip>Manage Dopus Folder Aliases</tip>
	<icon1>#ManageFolderAliases:AliasBlue</icon1>
	<function type="normal">
		<instruction>ManageDopusFolderAliases</instruction>
	</function>
</button>

You don't need to call Update. Add will add a new alias or modify an existing one.

After calling add, if I read the path value I get the old value. If I call update I get the new value.

That's a bug. We'll fix it in the next update.

1 Like

Thanks, no rush. I was just playing around, DOpus has a much better dialog in the settings to do this.

This works now thanks.

1 Like