option explicit Dim RootPath RootPath = DOpus.FSUtil.Resolve("/mydocuments") Function OnInit(initData) initData.name = "AutoTreeRoot" initData.desc = "Automatically set the tree root to a folder in new windows" initData.copyright = "(C) 2015 Leo Davidson" initData.version = "1.0" initData.default_enable = true End Function Function OnBeforeFolderChange(beforeFolderChangeData) Dim Cmd If (beforeFolderChangeData.initial) Then If (DOpus.FSUtil.ComparePath(beforeFolderChangeData.path, RootPath, "p")) Then Set cmd = DOpus.Create.Command cmd.SetSourceTab beforeFolderChangeData.tab cmd.RunCommand "Set TREEROOT=""" & RootPath & """" End If End If End Function 'Function OnActivateTab(activateTabData) ' SetTreeRootTab(activateTabData.newtab) 'End Function 'Function OnAfterFolderChange(afterFolderChangeData) ' If (afterFolderChangeData.result) Then ' SetTreeRootTab(afterFolderChangeData.tab) ' End If 'End Function 'Function OnListerUIChange(listerUIChangeData) ' If InStr(listerUIChangeData.change, "tree") > 0 Then ' SetTreeRootLister listerUIChangeData.lister ' End If 'End Function 'Function SetTreeRootLister(lister) ' Dim leftTab, rightTab ' ' If (lister.activetab.right) Then ' Set rightTab = lister.activetab ' Set leftTab = lister.desttab ' Else ' Set leftTab = lister.activetab ' If (lister.dual <> 0) Then ' Set rightTab = lister.desttab ' Else ' Set rightTab = Nothing ' End If ' End If ' ' If (lister.tree = 1 or lister.tree = 3) Then ' SetTreeRootTab leftTab ' End If ' ' If (lister.tree = 2 or lister.tree = 3) Then ' SetTreeRootTab rightTab ' End If 'End Function 'Function SetTreeRootTab(tab) ' Dim Cmd ' ' If (DOpus.FSUtil.ComparePath(tab.path, RootPath, "p")) Then ' Set cmd = DOpus.Create.Command ' cmd.SetSourceTab tab ' cmd.RunCommand "Set TREEROOT=""" & RootPath & """" ' End If 'End Function