StyleSetter - Enable panels in specific folders

This script adds the ability to show DOpus panels for specific folders.

It does this by using DOpus's built in Styles feature. As you navigate in and out of the target folder the styles will be applied, enabling and disabling the desired features.

Setup

We need to create at least two Styles. One StyleSetterDefault used when leaving the target folder. One other with the setting you would like to enable used when entering the desired folder. We then need to create a file in the target folder called folder.xml. This will contain the name of the style to show for that folder. Finally there is a button to enable the StyleSetter as you prob don't want it on all the time.

Resources

StyleSetter.js.txt v0.5 (4.1 KB)

Button to enable StyleSetter (only needed if config RequireEnabledVariable is set to true).

<?xml version="1.0"?>
<button backcol="none" display="icon" label_pos="right" textcol="none">
	<label>Enable Style Setter</label>
	<tip>Enable the style setter script for this window.</tip>
	<icon1>#default:viewpanelayout</icon1>
	<function type="normal">
		<instruction>@toggle:if $lst:StyleSetterEnabled</instruction>
		<instruction>@ifset:$lst:StyleSetterEnabled</instruction>
		<instruction>@set lst:StyleSetterEnabled</instruction>
		<instruction>@ifset:else</instruction>
		<instruction>@set lst:StyleSetterEnabled=true</instruction>
		<instruction>@ifset:common</instruction>
	</function>
</button>

Example: to show the Viewer Pane

  1. StyleSetterDefault This is the style that will be set when you leave the target folder.
    Note how all this style does is turn off the desired feature.
    image

  2. ShowViewer The target style, this that will be set when you enter the target folder folder.
    Note how all this style does is turn on the desired feature.
    image

  3. folder.xml for target folder. To be created in the target folder.

<?xml version="1.0" encoding="UTF-8"?>
<dopus>
  <style>ShowViewer</style>
</dopus>

Hiding the folder.xml file

Click to see how to hide the folder.xml in the dopus lister

The folder.xml file can be hidden using the Global Filters feature of DOpus.

Methods of hiding file

  1. Set the file as hidden, and enable Hide hidden files in the Global Filters
  2. Add the name of the file *Default Folder.xml to the Global Wildcard Filter. This way you can keep hidden files visible.

If the file is hidden it will be indicated on the Status Bar, where clicking the hidden section will temporally disable the filter and show the file.

This was requested here Panels only for one (or more) folder

Hi, Thanks for the script.
Do I need to type anything into the xml file apart from the style name?

I uploaded the wrong version, it had a bug so wont work. Try version 0.3.

Did you see inside the example above? The xml should look like this.

<?xml version="1.0" encoding="UTF-8"?>
<dopus>
  <style>ShowViewer</style>
</dopus>

Don't miss the need to add the button to enable and disable the functionality.

1 Like

Updated to version 0.4:
Changes

  • Inverted the logic for the Enable/Disable toolbar button, the variable that is set now used to disable the functionality not enabled it. This makes it a little easier to install. As it will run by default and adding the button allows you to disable it from the tool bar.
    If you installed and earlier version you will need to delete the button and copy the new one when upgrading to 0.4.

Updated to version 0.5:
Changes

  • rolled back changes for 0.4. Added Config flag RequireEnabledVariable to turn off the need for the button. By default RequireEnabledVariable is set to false and the script will always run. If RequireEnabledVariable is set to true you will need to add the button and click it to enable the script.

Hello again. I'm back after a bit of sleep, ready to try again. You had said in the other thread

Firstly, thanks for updating your OP, regarding hiding the folder.xml file. Easy enough to follow and understand, so consider issue #1 as resolved.

Now, about issue #2, I would agree that your script should open the viewer pane to the same size as when Leo's script passes the command of 'Set VIEWPANE=on', however it is not working that way, as I described in the other thread.

I dug around in my Prefs, and cannot see any way to specify how to open the viewer pane to an exact size. Have you any idea how to resolve this?

You are right, it does the same for me. I assumed applying the style that enables the viewer would use the current default width, the same as if you turned it on or off. But that appears not to be the case.

Hopefully @leo or @jon will see this and can comment.

Aside, I created a new version. v0.6 I wont post it at the top yet, as I was in a hurry.

  • Changed the DOpus version restriction to 11.9
  • Added support for configuring the folder styles via the script config. If you don't want to create the folder.xml files.

If it has issues just use 0.5 I will come back to it :slight_smile:

StyleSetter.js.txt v0.6 (6.7 KB)

Many thanks, I'll give this version a try and report back with the results.

UPDATE: I installed the v0.6 script, and in the Prefs I configured the FoldersConfig section so that it pointed to my test folder. I then removed the folders.xml file from my test folder, and gave the new script a try.

It did not turn on the viewer when I entered my test folder. I double checked to make sure that I had the 'ShowViewer' style still active, and it is.

To further test it, I went back and configured the FoldersConfig again, and removed the path to my test folder, so that it was just blank. I put back the folders.xml and tried again, and this time the viewer did open, just as in the past, but still at the small size.

So, there perhaps might be a small issue with that section???

Also, I ran across this thread while searching for solutions. Maybe it will help?

Styles save the viewer width. Resave the style with the width you want and it should use it.

I see no place to enter the value for width in the Edit Lister Style box. Only the option to choose Off, Horizontal, or Vertical.

So my next try was to delete the style, then open the Viewer Pane to the size I wanted. With the pane still opened, I made another style for the viewer. I then tried the script again, but it still only opened a small viewer on the right side of the screen...

You just save the style with the viewer (and everything else) how you want then to be.

Well, as I said in post #9, I did that, but it did not 'take'. Again, I had the viewer opened, to the size I wanted, then saved the style. But the next time the script opened the viewer, it was not the size I saved it as in the style...

You might need to update the default lister as well in that case. Settings > Set As Default Lister.

In Opus 12 you can do that with the viewer pane closed and it will remember the size it was last open. In earlier versions, it would only remember the viewer pane size if it was open when you saved it (and you could save it again with the viewer closed if you waned the viewer off by default). I'm not sure which way around Opus 11 worked, off the top of my head.

I deleted the style, opened the viewer to the size I want, saved the style again. Then closed the viewer, and saved default lister.

Tried the script again, but same result as always, small viewer on the right side of the screen..

I'd love to run Opus 12, but I'm an old, disabled Vet, living on a very very small budget, and I just cannot afford to purchase version 12. That's why I have to make due with what I have. Hope you understand?

Even tho 4wd polished up Leo's script, and I was able to see my mistakes, I would still rather use your script. Reason is that it provides a faster, more flexible way of using the viewer pane. Rather than add folders to the script to expand usage (using Leo's modded script), I could simply add the folder.xml file to whatever folders I want, and things would be good to go.

If only the issue of viewer pane size can be resolved, then it would be golden and I would adopt it for daily use.

I could not get the style to work. So I updated the script to support running a command as well as setting the style.

  1. In the setting change the FallbackSettings to
{
  "style": "",
  "commands": [
    "Set VIEWPANE=Off"
  ]
}
  1. Create the folder.xml to contain
<?xml version="1.0" encoding="UTF-8"?>
<dopus>
  <style></style>
  <commands>
	<command>Set VIEWPANE=On</command>
  </commands>
</dopus>

Again its a work in progress.
StyleSetter 0.7.js.txt (8.5 KB)

1 Like

Nicely done!!! Works very well now using the larger sized viewer pane. I tested it on several folders, and it works without a hitch. I thank you for your effort on this script, and after plodding my way thru some very minor coding yesterday, I have a newfound respect for you (and anyone) who does coding like this.

Well done!!

Is there a way to do this for the folder tree? Unless I am missing something, I can get the Viewer Pane to adjust size, but not the folder tree.

Thanks