Open files as if they were archives

7-zip has a very useful feature for me, where it allows you (if possible) to open any file as if it were an archive.
Even more useful is the possibility to open the file in question as an archive (or folder) in a new tab in DO. It seems to work in most cases, but first that file extension must be registered in Prefs PAGE="zip" as an archive type. Is there any way to skip this previous step (the registration part)?

Only ways are to add the extension to the list, or rename the file.

I see. And there doesn't seem to be a way to do it via scripts either. In the future, could you consider adding a new argument to the GO command to open a file as an archive?
eg. Go "C:\\" NEWTAB=tofront ASARCHIVE


1 Like

It's not easily possible, due to the design of things. The extension needs to be considered an archive, for the duration of time the archive is being used, for it to work.

How about some way via scripting to modify the list of extensions in Prefs PAGE="zip"?. So one can temporarily register the extension as archive, (try to) open the file and then remove the extension from that list.

Easier to rename the archive, surely?

Or open it in 7-Zip.

1 Like

Fine Leo. Thanks anyway
Thinking about how to do this via scripting, and taking Leo's advice, I've come up with a way to automate the process. For anyone interested in trying it out, feel free to contact me via DM, as I don't think the command is ready to be published.

I'll wait for you to post it. I appreciate all the work you do to expand on the feature set of Directory Opus.

1 Like

The other advantage in renaming the archive instead of having the script change global Preferences back and forth is it means two instances of the script (or anything else that’s dependent on the same settings) can run in parallel without messing each other up or not correctly setting Preferences back to their original state.

I can see the benefit of opening a file 'as archive'. For example, to peek into the files inside an epub or any other file that is an archive (but with a different extension) that will usually be opened with another application.

I don't see that as a problem if the script is built to take that into account. But I understand your point Leo, one doesn't know how the user is going to end up using the product, and it might even be the complete opposite of what you had in mind in the design. And especially with something that messes with the global configuration, the forum could fill up with complaints from people who don't know why a certain configuration ends up changing itself :smiley:
And the same applies for a command that must rename a file, watch that certain conditions are met, and then return it to its original name :slightly_smiling_face:

@jinsight, I really appreciate your words. Thanks!

@BuckyB for those cases where you already know the extensions, I think it would be easier to add them to the list of extensions in Prefs PAGE="zip".
I was talking about for cases like mine, where I often have to deal with files with randomly changing extensions, which are only opened with proprietary crappy software. In the background they look like Excel files in disguise, and for me it is easier to open certain files as text and extract the relevant parts.
A demo of the open as zip command looks like this:

As you can see in the video, the rename is transparent to the user. But there are many factors to take into account and for this it is essential to do several tests in different scenarios, unless you want to end up with renamed files.

As well as renaming the file another way would be to create a temporary hardlink to the file with the correct suffix. Then just delete the hardlink when done. Or if you create it in the %TMP% folder (assuming it's on the same drive) you could just leave it there, since it wouldn't actually take up any disk space.

1 Like