GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Archives only view toggle button V2

This button makes it easy to see and manage all your archive files (.zip, .7z, ect). Basically it filters out all non-archive files so that you only see archives. Configurable and flexible with options to filter out archives bigger or smaller then a size you specify, include or ignore archives in subfolders, and an option to show / hide folders.


The following is default:

Flatview Mode: No Folders
File Size Filter: <1mb
Hide Folders? Yes


Settings description:


Access the settings by right clicking on the button.

Flatview mode: 1) No folders 2) With Folders 3) Off

Flatview mode views the current folder and all subfolders as if they were a single folder. Enabled with options 1 and 2. Disabled with option 3.

  1. Shows all archive files contained in subfolders but hides the folders themselves
  2. Shows all archive files contained in subfolders and shows the folders containing them
  3. Only displays archive files in the current folder

File Size Filter: User enters the desired value

The File Size Filter allows the user to filter out files based on size. For example, if you are looking for large picture archives that you know are bigger then 1GB, you can filter out all archives less then that with <1000mb

Uses the following format: [< or >][size in MB][mb]

<30mb will filter out all files less than 30MB
<0mb will disable the file size filter


Hide folders: 1) Yes 2) No

Hide or show folders (when flatview is disabled). Useful if you only want to see archive files and don't want to crowd the display with folders.

  1. Will hide folders
  2. Will show folders

** Hide folders does not apply to flatview. If you have flatview enabled (options 1 or 2), flatview's folder show/hide settings will take precedence. If you are using flatview, this setting does not matter.


Archives Only.dcf (2.8 KB)


Main Button

@toggle:if Set SHOWFILTERFILENAME="*.(zip|rar|7z|arj|bz2|bzip2|cb7|cbr|cbz|gz|gzip|lha|lzh|lzma|lzma86|r00|r01|tar|taz|tbz|tbz2|tgz|tlz|tlzma|tpz|txz|xz|z)"

// Checking if configured.  If not, defaults are loaded.
@if:!$glob!:AOFlatView
@set glob!:AOFlatView=On,MixedNoFolders

@if:else

@if:!$glob!:AOIgnoreSmallFiles
@set glob!:AOIgnoreSmallFiles=<0mb

@if:else

@if:!$glob!:AOHideFolders
Set HIDEFILTERFOLDERS=*

@if:else


// Turing button off
@if:Set SHOWFILTERFILENAME="*.(zip|rar|7z|arj|bz2|bzip2|cb7|cbr|cbz|gz|gzip|lha|lzh|lzma|lzma86|r00|r01|tar|taz|tbz|tbz2|tgz|tlz|tlzma|tpz|txz|xz|z)"
Set FLATVIEW=off
Set FORMAT=!folder

// Turing button on
@if:else
Set FLATVIEW={$glob!:AOFlatView}
Set SHOWFILTERFILENAME="*.(zip|rar|7z|arj|bz2|bzip2|cb7|cbr|cbz|gz|gzip|lha|lzh|lzma|lzma86|r00|r01|tar|taz|tbz|tbz2|tgz|tlz|tlzma|tpz|txz|xz|z)"
Select SIZE {$glob!:AOIgnoreSmallFiles} DESELECTNOMATCH HIDESEL

Settings button

@set glob!:AOFlatView={dlgchoose|Choose Flatview Mode:|No Folders (Default)=On,MixedNoFolders+With Folders=On,Mixed+Off=off }
@set glob!:AOIgnoreSmallFiles={dlgstringS|File Size Filter:\n\nFormat: [< or >][Size in MB][mb]\nEx: <30mb This will filter out all files less than 30MB\n>1000mb will filter out all files greater than 1000MB\nEnter <0mb to disable|<1mb}
@set glob!:AOHideFolders={dlgchoose|Hide Folders?|Yes (Default)= +No=Ӝ}


Old Version

Please note this version is not configurable and does not include a file size filter.

Archives only.dcf (1015 Bytes)


Instead of including all the archive extensions in the button, you can probably simplify that line to this:

Set SHOWFILTERFILENAME=grp:Archives

That's assuming all the extensions (that you care about) are included in your Archives file type group.

Thanks for the tip Leo. I actually excluded some extensions like .cab and .iso as they would crowd the lister with unintended results. .cab are almost exclusively used for installers like DirectX for example. .iso didn't make much sense when looking for archives.

It's definitely good to know that you can filter by groups like that.

I'm not 100% sure about many of the more esoteric extensions so if you could point out any others that wouldn't make much sense for this use case it would be a big help.

Also wondering, is it possible to store your current showfilterfilename and hidefilterfolders in a variable before the button applies it's own and then restore those when toggling the archives only off?

If I'm reading the DO reference correctly I would do something like

@set SFFN=SHOWFILTERFILENAME
@set HFF=HIDEFILTERFOLDERS

Then to after the user is done with the archive only view, they would call the variables like this?

Set SHOWFILTERFILENAME={$SFFN}
Set HIDEFILTERFOLDERS={$HFF}

Scripts have access to the filter bar's current settings and would be able to do that.

Re esoteric archive types, whichever you don't use. For me that'd be everything other than zip, rar and 7z. For you it might be different. Only you can really answer that.

Thanks Leo!

I seem to be having trouble finding how to access the current hide folder filter and show folder filter in the scripting reference. All I'm looking to do is to gather the value of the these two before the script changes them and then restore them once the user toggles them off. I have this so far

@set SFFN={SHOWFILTERFILENAME}
@set HFF={HIDEFILTERFOLDERS}

@if:Set FLATVIEW=On
Set CLEARFILTERS
Set FLATVIEW=off
Set SHOWFILTERFILENAME={$SFFN}
Set HIDEFILTERFOLDERS={$HFF}

@if:else
Set SHOWFILTERFILENAME="*.(zip|rar|7z|arj|bz2|bzip2|cb7|cbr|cbz|gz|gzip|lha|lzh|lzma|lzma86|r00|r01|tar|taz|tbz|tbz2|tgz|tlz|tlzma|tpz|txz|xz|z)"
Set HIDEFILTERFOLDERS=*.
Set FLATVIEW=On,MixedNoFolders
@toggle:invert

I just need to know how to get a script to pass along showfilterfilename and hidefilterfolders.

They're available in the Format object.

Ah I see, scripting in opus isn't as simple as creating a function and calling that function using a DOPus internal command. I have to rewrite the entire script. Is there any way to get intellesense for scripting? Either though the in program editor or a different IDE like visual studio?

There may be an easier way to do what you're trying to do. You can use the Set SAVEFORMAT command to save the current format as a favorite, and then the Set FORMAT command to apply a favorite format to the current display. You could try something like this:

@if:Set FLATVIEW=On
Set FLATVIEW=off
Set CLEARFILTERS
Set FORMAT "Temp Format"

@if:else
Set SAVEFORMAT=favorite FORMAT "Temp Format"
Set SHOWFILTERFILENAME="*.(zip|rar|7z|arj|bz2|bzip2|cb7|cbr|cbz|gz|gzip|lha|lzh|lzma|lzma86|r00|r01|tar|taz|tbz|tbz2|tgz|tlz|tlzma|tpz|txz|xz|z)"
Set HIDEFILTERFOLDERS=*.
Set FLATVIEW=On,MixedNoFolders
@toggle:invert

That should work. Good idea using a format to save and then reload the prior folder format settings.

Yep, this worked perfectly. I made 2 changes to improve it a bit more as well. The format name is now zz[temp]. This is so that it will always appear at the bottom of the favorites list (out of the way) and it's a common name that can be used by other buttons should the need arise.

I also changed the if condition to the showfilterfilename. This should prevent any conflicts with folders that already have flatview set to on. I can't think of any instance where it would now conflict with another folder format or setting outside a button that does the same thing.

1 Like

Thank you for this button.

This almost does what I'm looking for except for one thing.

How can I make it so instead of applying the effect to the current folder, It goes first to a specified folder before doing the rest this code is doing.

I know I have to include a GO Path Command somewhere, that's my guess, but I really dont exaclty where in the code to put it or if there's a better way.

Thank in advance for your help

BTW, First Post here. LOL

=== EDIT 1 ===

I know this would go into sub-folder's I wanted to explain better that I meant to define the starting folder before the button does its action.

== EDIT 2 ===

If I add to the Begining the following

Go PATH="C:\Users\Name\Documents\Graphics Work"

It works as I want but with a small issue.

The button will stay like if its toggled.

This is what I have Right Now

Go PATH="C:\Users\Name\Documents\Graphics Work"
@if:Set SHOWFILTERFILENAME="*.(afdesign|afpub)"
Set FLATVIEW=off
Set FORMAT "zz[temp]"

@if:else
Set SAVEFORMAT=favorite FORMAT "zz[temp]"
Set SHOWFILTERFILENAME="*.(afdesign|afpub)"
Set HIDEFILTERFOLDERS=*.
Set FLATVIEW=On,MixedNoFolders
Set VIEW=Thumbnails
@toggle:invert

Remove the @toggle:invert from the end and the button won't appear permanently "on" anymore.

You could also use @toggle:if Set SHOWFILTERFILENAME="*.(afdesign|afpub)" if you want it to appear active in one state and not in the other.

Or you could move the Go ... command inside the two @if:... blocks, so the default toggled state is based on the @if line instead of the Go line.

1 Like

I'll try that as soon as I go back to my pc ... thanks for the time

@toggle:if Set SHOWFILTERFILENAME="*.(afdesign|afpub)"

That one did the trick. Thanks

You want

Go PATH="C:\Users\Name\Documents\Graphics Work"

to be inside the if:else statement. If you don't put it inside, it will apply the above argument every time you click the button, meaning the toggle function will not work. Like this

@if:Set SHOWFILTERFILENAME="*.(afdesign|afpub)"
Set FLATVIEW=off
Set FORMAT "zz[temp]"

@if:else
Go PATH="C:\Users\Name\Documents\Graphics Work"
Set SAVEFORMAT=favorite FORMAT "zz[temp]"
Set SHOWFILTERFILENAME="*.(afdesign|afpub)"
Set HIDEFILTERFOLDERS=*.
Set FLATVIEW=On,MixedNoFolders
Set VIEW=Thumbnails
@toggle:invert

In this example you can also keep the @toggle functionality.

1 Like

Thank you, Not only for providing the code sample but also because in doing so you helped me learned a little bit more about it with your explanation.

This one works perfect and also retain the @toggle functionality.

This helps me a lot when I need to open an Affinity file by looking at the thumbnails all at one instead of trying to remember their names.

Having a button that does that with one click really saves me a lot of time.

1 Like

Happy to help! I'm glad people are finding my code useful.

1 Like

Really great script and just like @Lare2 describes it is great to see a way to work with filters. Thank You

2 Likes

It's a very good button, Thank you so much.

1 Like