option explicit ' FTPSiteTabNamer ' ' This is a script for Directory Opus. ' See https://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 = "FTPSiteTabNamer" initData.version = "1.0" initData.copyright = "" ' initData.url = "https://resource.dopus.com/viewforum.php?f=35" initData.desc = "" initData.default_enable = true initData.min_version = "12.0" End Function ' Called after a new folder is read in a tab Function OnAfterFolderChange(afterFolderChangeData) if afterFolderChangeData.result then Dim cmd, strName Set cmd = DOpus.Create.Command cmd.SetSourceTab(afterFolderChangeData.tab) if Left(afterFolderChangeData.tab.path, 11) = "ftp://SITE=" then strName = """" & URLDecode(Mid(afterFolderChangeData.tab.path, 12, InStr(afterFolderChangeData.tab.path, "?") - 12)) & """" end if cmd.RunCommand("Go TABNAME " & strName) end if End Function ' from https://dwarf1711.blogspot.com/2007/10/vbscript-urldecode-function.html Function URLDecode(ByVal str) Dim intI, strChar, strRes str = Replace(str, "+", " ") For intI = 1 To Len(str) strChar = Mid(str, intI, 1) If strChar = "%" Then If intI + 2 < Len(str) Then strRes = strRes & Chr(CLng("&H" & Mid(str, intI+1, 2))) intI = intI + 2 End If Else strRes = strRes & strChar End If Next URLDecode = strRes End Function