Goto a folder AND load a Folder Format

Consider a destination folder DEST.
I have an alias ALIAS1 pointing there which I use.
Now I want an ALIAS2 (or equivilent function preferably invoked in the same or similar way) which will go to the folder DEST AND load a defined folder format.
IS this possible?
Maybe with a macro...?

Many thanks....for any comments.....

You could make a user command which does that and run it by pressing > instead of / (or just set it up as a hotkey).

You might be able to stick to using aliases and have a script intervene, but I suspect the alias will be resolved to what it points to before the script sees it, so that may not work. (Since you want two different formats for the same folder; else folder formats could take care of things without any aliases or commands.)

Leo you are so quick.
I was experimenting (while you were typing) and I have indeed a simple command as follws:

Command name = GOANDF

go /Training
set format = "TT"

Which works a treat.
Interesting thing is with the following sequence:

Location = Mycomputer
GOANDF
Location = Training. Format set to TT (i.e. command works)
/Mycomputer
Location = Mycomputer, no filter set
/Training
Location = Training. Format set still set to TT
Is this a caching effect within the lister?
Can it be turned off?/Altered?

I will run with my command for a while and see what tweaks I might want as I go.

Once again my thanks.
I would love to buy you a beer/coffee/iced tea/<insert beverage of your choice> sometime

Yes, if you change the format explicitly then that change will be carried over when you go to other folders, until you go to a folder which triggers a different format to be loaded (e.g. one specific to that folder's path). The more detailed folder formats faq has a bit more info on how it works.

You can run set format=!folder to reset to the current folder's natural format.

1 Like

Here is a rather naive script which you can drop into the Script Addins folder (name is resetfolder.js for example)

After changing the folder in a tab, it will force a reset of the format.
Note that it honours the 'lock' setting (the tiny padlock icon in the bottom left) and won't
mess with the format if that is ticked.

Its overkill because it messes with the format on every change, and doesn't pay attention to
whether you want to preserve the format in subfolders etc...
but it might be a start if you want to make something more functional..

Cheers

// Reset folder format on every directory change

// Called by Directory Opus to initialize the script
function OnInit(initData)
{
	initData.name = "Reset Folder Format";
	initData.version = "1.0";
	initData.copyright = "(c) 2019 PerlLlama";
	initData.desc = "Resets the default format for every folder.";
	initData.default_enable = true;
	initData.min_version = "12.0";
}

function OnAfterFolderChange(data)
{
	if( data.tab.format.locked == false) {
		var cmd = DOpus.Create.Command;
		cmd.RunCommand("SET FORMAT=!folder");
	}
	return false;
}

@PerlLlama that is incredibly helpful thank you.
As you say it gets me going and it is so much easier to tweak. Very very grateful

I have been working on this post which I think amounts to a feature request.
It is a massive advantage for me when using the FAYT feature in GO mode that it offers "automatic path-completion". No need to explain why I think. I have many many aliai (Is that correct pural of alias? Nevermind) often with long alias names but i only need to type a few strokes then I can select.
Crucially I also only need to remember the first few letter of an alias name.
By adopting a naming convention with my aliai I then can quickly access many many aliai quickly and efficiently.
Q1 I am assuming that no similar "automatic command name completion" feature exists for the command mode?
Q2 Would the brains trust at Opus consider implementing such a feature?

This would bring to bear commands with the same power as described for aliai above.
I am sitting here thinking of all the command combinations I would find useful but how to remember their names?
A naming convention is the first answer I come to.
But this implies longer and longer command names...
Hence this request.
I close this request/blog with 2 examples of the aliai I deploy.
Notice the prefixes. I just rmember the prefix and I can go and choose.
I would love to be able to do that with commands...

Commands can also be external programs (name only, via the system PATH variable, or a full path) as well as internal, user and script commands. I'm not sure completion on them would help much here.

If it's something you use a lot, you could make the command something short, even a single letter. Then there's no need for completion.

You could also use a hotkey instead of a command.