Make tab label match favorite name

Drop this script on to Preferences / Toolbars / Scripts and it will rename the tab when you are in that folder, regardless of how you enter the folder (doesn't have to be via the Favorite).


Script code for reference:

option explicit

' SimpleTabRenamer

' 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 = "SimpleTabRenamer"
	initData.version = "1.0"
	initData.copyright = ""
	initData.url = "https://resource.dopus.com/t/make-tab-label-match-favorite-name/28999"
	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 (afterFolderChangeData.tab.path = "E:\Documents\Pictures\Cloud Photos\Downloads") then
		
			strName = "(%R) iCloud Photos"
			
		end if
		
		cmd.RunCommand("Go TABNAME=""" & strName & """")

	end if
End Function
2 Likes