DO12 - Utility Panel behaviour change

OK, thanks, Leo. Looks like I'll need to brush up on my scripting language to get the behaviour I want. At least I've finally got some time now that I'm retired!

You shouldn't need to change the script itself, just the command it runs.

If you link your account one of us can write it for you, if needed.

OK, Leo, I'm linked.

Download and drag into Preferences / Toolbars / Scripts:

SyncOff.vbs.txt (674 Bytes)

Script contents for quick reference (same as the .txt file above):

[code]option explicit

' Called by Directory Opus to initialize the script
Function OnInit(initData)
initData.name = "Hide Sync in New Listers"
initData.desc = "Override layouts to always turn off the Sync panel in new listers"
initData.copyright = "(C) 2016 Leo Davidson"
initData.version = "1.0"
initData.default_enable = true
End Function

' Called when a new Lister is opened
Function OnOpenLister(openListerData)
Dim OpusCmd
Set OpusCmd = DOpus.NewCommand
OpusCmd.SetSourceTab openListerData.lister.activetab
If OpusCmd.IsSet("UTILITY=Sync,Toggle") Then
OpusCmd.RunCommand "Set UTILITY=Sync,Toggle"
End If
End Function[/code]

OK, thanks for the script, Leo. I'll give this a go.
The thing that bothered me most about this change is that I use the Explorer layout, and even if I manually closed the Utility Panel before closing dopus, I'm left with a sort of dual vertical display of the source and destination drives, and I then must click on the Explorer layout tab to get things back the way they were. Hopefully, this script will straighten things out.

Leo,

While this script does indeed get rid of the Sync Panel, I'm still left with the dual vertical display of the source and destination drives. As well, I must readjust the Folder Tree panel's width, as it gets shoved over to the left afterwards, because when I hit the Explorer tab to get my original display back, the Folder Tree panel's width reverts to its default, which is a bit narrow for my purpose. Now I just need to find where I can specify that width, and I'll probably be all set...with an extra click or two, of course.

Scratch that last bit about the Folder Tree panel; it turns out that all I've got to do is close the destination drive display and I'm back to business.

The script would not turn on dual-display. If that's on when it shouldn't be, it must be the way the default lister (or layout, if you're opening a layout) is set up.

If Preferences / Launching Opus / Default Lister / Update Default Lister automatically when closing a Lister is on then the default lister should look like the last window you closed. If it's off then it should look like the last window you used Settings > Set as Default Lister in.

Preferences / Launching Opus / Startup / Open the Listers that were open when the program was last closed can also come into play when launching Opus if it is not already running.

(Also, just to clarify, "Explorer" is a style, not a layout. Styles usually only take effect when you click on them in the menus/toolbars, and only right at the moment you click on them. After clicking on a style, you can change things in the window and no longer have it matching that style, such that selecting the same style again will change things back. The old Styles tabs from Opus 9, which it sounds like you're still using, were misleading as they suggested styles were states when they aren't. That's one of the reasons the default toolbars changed to no longer use tabs and move Styles into a menu.)

The dual display is a product of the Synchronize function, with the source directory on the left, and the destination on the right, so if I close the destination pane, then it's back to where I started.

But you've pointed me to where the difference is, I think, between version 12 and previous ones. In previous versions, when it comes to the Synchronize command at least, Preferences / Launching Opus / Default Lister / Update Default Lister automatically when closing a Lister behaves as though it's unticked even though it is, e.g., the next time I open Opus, it reverts back to the state it was in when I first opened it, as though the default lister has not been updated. In version 12, however, it behaves as expected. So, with version 12, then, I've got to have it unticked to get the same Synchronize behaviour as, say, version 10 or 11. I'd be interested to know if you can duplicate this.

And you're right; I still use the old Styles tabs.

Here's an alternative script which does things before the lister closes, rather than when it opens. It should make things similar to the old behaviour.

If the sync panel isn't open, nothing changes.

If the sync panel is open, it will be closed automatically just before the lister closes. If the dual file display is also open, and only has one folder tab, it will also be closed. Then the window will close and the default lister is updated.

SyncOff2.vbs.txt (881 Bytes)

[code]option explicit

' Called by Directory Opus to initialize the script
Function OnInit(initData)
initData.name = "Turn off Sync before updating the Default Lister"
initData.desc = "Closes the Sync panel and dual file display as listers close"
initData.copyright = "(C) 2016 Leo Davidson"
initData.version = "1.0"
initData.default_enable = true
End Function

' Called when a new Lister is opened
Function OnCloseLister(closeListerData)
Dim OpusCmd
Set OpusCmd = DOpus.NewCommand
OpusCmd.SetSourceTab closeListerData.lister.activetab
If OpusCmd.IsSet("UTILITY=Sync,Toggle") Then
OpusCmd.RunCommand "Set UTILITY=Off"
If closeListerData.lister.dual <> 0 Then
If closeListerData.lister.tabsright.count = 1 Then
OpusCmd.RunCommand "Set DUAL=Right,Off"
End If
End If
End If
End Function[/code]

OK, Leo, I'll give this one a go and report back. Thanks much.

Leo, whilst this new script does close the destination part of the display left by the Sync command, the script appeared to generate an error:


I tried it again, and didn't get the error, so I'm not quite sure if it was coincidental with something else that happened.

Actually, I found a way to generate the above error more reliably; answer No to the query in the above example instead of Yes. That seems to do it every time.

Sorry about that.

Please zip and email the crash dumps to leo@gpsoft.com.au and I'll see if I can work out what's going wrong.

I just sent it.

Thanks again for all your help with this.

Here's a quick fix for the crash, which can be avoided by changing the order the script closes things:

SyncOff2.vbs.txt (881 Bytes)

We'll also do a code-change so that Opus won't crash when it does things the original way around.

Thanks, Leo. It now works.

In the next beta we'll add the ability for the OnCloseLister script event to stop the Lister being saved as the new default, which will let you get back the original behaviour exactly.

Okay, Jon, thanks for the heads up.

Jon, thanks for this change. I just added the script and it works great.