Overview
This simple script allows you to automate switching of selected view modes by specified actions. For example, it can be useful when viewing a large number of folders with images or videos.
How to use?
- Download View Modes Switcher.vbs.txt (2.7 KB)
- Open Preferences > Toolbars > Scripts and drag the downloaded file into the list.
- Select the new View Modes Switcher item and press Configure.
How to configure?
For example, you need switch to Thumbnails every time you open folder by double click, and switch back to Details when go to parent folder.
- choose from drop-down list dblclk as Action1 value
- choose from drop-down list parent as Action2 value
- choose from drop-down list Thumbnails as Mode1 value
- choose from drop-down list Details as Mode2 value
- double click on Switch1 and Switch2 to enable them
- press OK > OK
Now, double click on any folder to open it. View mode should change on Thumbnails. Double click on file display background to go to parent folder. View mode should change on Details.
Script Code:
The script inside the download above is reproduced here for reference:
Option Explicit
Dim ActionList, ModeList
Set ActionList = DOpus.NewVector(0, "none", "normal", "refresh", "parent", "root", "back", "forward", "dblclk")
Set ModeList = DOpus.NewVector(0, "none", "LargeIcons", "SmallIcons", "List", "Details", "Power", "Thumbnails", "Tiles")
Function OnInit(InitData)
InitData.name = "View Modes Switcher"
InitData.desc = "Automatic switching view modes."
InitData.copyright = "(C) 2014 TVB"
InitData.version = "0.3"
InitData.default_enable = False
InitData.config.Action1 = ActionList
InitData.config.Action2 = ActionList
InitData.config.Action3 = ActionList
InitData.config.Action4 = ActionList
InitData.config.Action5 = ActionList
InitData.config.Action6 = ActionList
InitData.config.Action7 = ActionList
InitData.config.Mode1 = ModeList
InitData.config.Mode2 = ModeList
InitData.config.Mode3 = ModeList
InitData.config.Mode4 = ModeList
InitData.config.Mode5 = ModeList
InitData.config.Mode6 = ModeList
InitData.config.Mode7 = ModeList
InitData.config.Switch1 = False
InitData.config.Switch2 = False
InitData.config.Switch3 = False
InitData.config.Switch4 = False
InitData.config.Switch5 = False
InitData.config.Switch6 = False
InitData.config.Switch7 = False
End Function
Function OnAfterFolderChange(AfterFolderChangeData)
If AfterFolderChangeData.action = ActionList(Script.config.Action1 + 1) Then
Call SetView(Script.config.Switch1, ModeList(Script.config.Mode1 + 1))
ElseIf AfterFolderChangeData.action = ActionList(Script.config.Action2 + 1) Then
Call SetView(Script.config.Switch2, ModeList(Script.config.Mode2 + 1))
ElseIf AfterFolderChangeData.action = ActionList(Script.config.Action3 + 1) Then
Call SetView(Script.config.Switch3, ModeList(Script.config.Mode3 + 1))
ElseIf AfterFolderChangeData.action = ActionList(Script.config.Action4 + 1) Then
Call SetView(Script.config.Switch4, ModeList(Script.config.Mode4 + 1))
ElseIf AfterFolderChangeData.action = ActionList(Script.config.Action5 + 1) Then
Call SetView(Script.config.Switch5, ModeList(Script.config.Mode5 + 1))
ElseIf AfterFolderChangeData.action = ActionList(Script.config.Action6 + 1) Then
Call SetView(Script.config.Switch6, ModeList(Script.config.Mode6 + 1))
ElseIf AfterFolderChangeData.action = ActionList(Script.config.Action7 + 1) Then
Call SetView(Script.config.Switch7, ModeList(Script.config.Mode7 + 1))
End If
End Function
Sub SetView(Switch, Mode)
If Switch Then
Dim OpusCmd
Set OpusCmd = DOpus.NewCommand
If OpusCmd.IsSet("VIEW=" & Mode & "") = False Then
OpusCmd.RunCommand("Set VIEW=" & Mode & "")
End If
End If
End Sub