option explicit ' NavLock Folder Create ' (C)2014 Leo Davidson ' ' This is a script for Directory Opus. ' See http://www.gpsoft.com.au/DScripts/redirect.asp?page=scripts for development information. ' ' ' ' Called by Directory Opus to initialize the script Function OnInit(initData) initData.name = "NavLock Folder Create" initData.desc = "When using NavLock, double-clicking a folder that only exists on one side will create it on the other side automatically" initData.copyright = "(c) 2014 Leo Davidson" initData.version = "1.0" initData.default_enable = true End Function ' Called before a new folder is read in a tab Function OnBeforeFolderChange(beforeFolderChangeData) Dim fac, cmd, fsu, tab, lister, pathCheck, folderName If (beforeFolderChangeData.initial) Then Exit Function End If If (beforeFolderChangeData.action <> "dblclk") Then Exit Function End If Set tab = beforeFolderChangeData.tab If (Not tab.source) Then Exit Function End If Set lister = tab.lister If (lister.dual = 0) Then Exit Function End If Set fac = DOpus.Create Set cmd = fac.Command cmd.SetSourceTab beforeFolderChangeData.tab If (Not cmd.IsSet("NAVLOCK=Toggle")) Then Exit Function End If Set fsu = DOpus.FSUtil Set pathCheck = fsu.NewPath(beforeFolderChangeData.path) If (Not pathCheck.test_parent) Then Exit Function End If pathCheck.Parent If (pathCheck = "") Then Exit Function End If If (Not fsu.ComparePath(pathCheck, tab.path)) Then Exit Function End If folderName = beforeFolderChangeData.path.filepart pathCheck.Set lister.desttab.path If (fsu.Exists(pathCheck)) Then pathCheck.Add folderName If (Not fsu.Exists(pathCheck)) Then cmd.SetSourceTab lister.desttab cmd.RunCommand "CreateFolder NAME=""" & folderName & """ NOSEL NOUPDATESETTINGS READAUTO=yes" End If End If End Function