Make tab label match favorite name

I have put E:\Documents\Pictures\Cloud Photos\Downloads as a Favorite in DOpus. The nice thing about Favorite is that I can named the folder whatever name I wanted. For this particular case, how can I match the Favorite name into the tab, because the tab currently shows (E:) Downloads (current folder name) and that can be confused with the actual Chrome Download folder E:\Downloads


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 for development information.

' Called by Directory Opus to initialize the script
Function OnInit(initData) = "SimpleTabRenamer"
	initData.version = "1.0"
	initData.copyright = ""
	initData.url = ""
	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

		if ( = "E:\Documents\Pictures\Cloud Photos\Downloads") then
			strName = "(%R) iCloud Photos"
		end if
		cmd.RunCommand("Go TABNAME=""" & strName & """")

	end if
End Function
1 Like

Excellent! Thank you, I downloaded the script and it works. Much appreciated!
The script seemed to cater to my specific case i.e. the exact file path matching a tab label.
How about if I need to match another file patch, say C:\Documents\Video, to a tab label My Videos, do I drop another .vbs script into Preference / Toolbars / Scripts ?

You want to have only one script of this type, else they will conflict with each other.

Instead of having two scripts, edit the script you have to cover any extra cases you need.

This is the part that you should edit:

		if ( = "E:\Documents\Pictures\Cloud Photos\Downloads") then
			strName = "(%R) iCloud Photos"
		end if

If you want to turn C:\Documents\Video into My Videos then change it to this:

		if ( = "E:\Documents\Pictures\Cloud Photos\Downloads") then
			strName = "(%R) iCloud Photos"
		elseif ( = "C:\Documents\Video") then
			strName = "(%R) My Videos"
		end if
1 Like

Brilliant... thank you soooo much!