Make a specific file auto-selected when going to a folder?

I would like Directory Opus to automatically have a specific file automatically selected whenever I visit a specific folder. For example, I would like dopus.exe to be selected whenever I go to the C:\Program Files\GPSoftware\Directory Opus folder. Is this possible?

You could do it using a script, since there's an event whenever the folder changes and the script could respond by selecting a file if it's in a particular folder.

This one kind of does it.
With kind of, I mean it selects the file if it's found in a specific folder, but it doesn't move the selection rectangle, so
when you use arrow up/down it starts from the top. I couldn't find a command which could move it.

afterFolderChangeData.path seems to always return null/undefined/blank, even though the documentation says it should be there.

Change the variables sSpecificFile and sSpecificFolder to whatever you'd like.
Make sure to double any backslashes, iow "\".
Currently they're set to d:\tmp and test.txt
SelectSpecific.zip (1003 Bytes)

Thank you for that, myarmor. I'll let you know how it works out for me.

That's a documentation bug, path is only provided if the read fails. You can get the actual path that was read from tab.path.

That's a documentation bug, path is only provided if the read fails. You can get the actual path that was read from tab.path.[/quote]
Yup, it was that one I found I had to use, hence why I mentioned it in case it was a doc or code bug.

Btw, it would be nice if one could move the selection rectangle (the border around one of the items) using code (either using SELECT, or through the Command object).

No problem. :slight_smile:
Btw, it says so at the top of the code, but it expects those paths/filenames to be lowercase only.

There seems to be some annoying issues with the script config thingy.
It doesn't really handle an array of strings. Sometimes it gives a collection in return (why??), sometimes it doesn't give anything at all.
In preferences, it doesn't display the contents of such a variable (other than changing the input to a memo).

I then tried to use a string where each path was separated by crlf, but the Preferences->Script->Configure apparently
can't handle a string that has crlf's in it, it displays that on a single line (standard editbox) rather than using a memo.

If you initialise it with a Vector you should get back a Vector every time.
Can you post a sample script where it goes wrong?

[quote="jon"]If you initialise it with a Vector you should get back a Vector every time.
Can you post a sample script where it goes wrong?[/quote]
Those vectors works nicely.

This one should slightly better.

  • Can select multiple files (or folders) in a folder,
  • uses a list of full (real) paths rather than separating path and filenames
  • no need for lowercase
  • uses the configuration mechanism in DOpus (Preferences->Toolbars->Scripts, Configure) for configuration.

if filesOnly is false it can select folders too, not just files.
If selectMultiple is true, then it can select multiple files/folders in the same folder (it requires literal matches as doesn't support masks...yet?)
You specify full paths (including filenames), one per line.
SelectSpecific.zip (1.37 KB)

I kind of found a use for the script myself. :slight_smile:

It would be nice if it was possible to add descriptions/hints for each parameter for use in the configuration dialog.