Does Opus have an API to expose the current sorting order of a folder?

Recently I installed ImageGlass. This program has an option that if you sort your folder by name for example all the pictures in ImageGlass will get shown in alphabetical order if you open them from that folder. The same happens if you sort the folder by date taken and then open images in ImageGlass.

The option is called "Use Windows File Explorer sort order if possible" and does not work with Directory Opus. I made a feature request on GitHub but I got this response:

We can develop the feature " Use Windows File Explorer sort order if possible " thanks to Windows API. But the third-party app like Directory Opus does not provide API so it's impossible to know the sort order.

Now I wanted to ask, is there also such an API in Directory Opus? This program is so powerful and has so many options that I may have missed it. I understand this is a very niche question / request so I just wanted to know if something like this exists in Opus already or if there is some way to emulate the Windows API.

Thank you.

You can get the file order via scripting, but I'm not sure if that would make sense.

If they can tell of which API they're using, or which source file to look at, we might be able to implement the same one in Opus. (Although it can be complicated sometimes, as Opus windows can contain multiple folders/tabs, and can launch programs on files that aren't even in the current folder.)

1 Like

Thank you for the your fast response and considering this request. I asked on GitHub for the API name and will report back if I get a reply.

1 Like

I got this reply:

The idea is Opus provides a command to retrieve the sort order (or even all the items in the list). For example:
Get sort order

# Command to get the sort order of the given directory
# It should return an integer corresponding to the sort order:
#     0: error
#     1: By name ascending
#     2: By name descending
#     3: By extension ascending
#     4: ...and so on...
opus.exe get-sort-order "C:\My photos\"

Get items in correct order

# Returns
#    0: error
#    1: successful
opus.exe extract-files "C:\My photos\" "C:\all-photos.txt"

This command lists all of the files in the given folder into a text file. By this way, it should also provides a flag option to include the hidden files in the result.

PS: It's kind of strange that this communication goes through me... Or to say at least a bit inefficient?

Thanks! I've replied in the github thread.

1 Like

Thank you. In case this will get implemented I can test the beta for sure.