"Unknown" format for folders not loaded at startup?

Here's a script add-in which fixes that:

Reset First Format.js.txt (905 Bytes)

function OnInit(initData)
{
	initData.name = "Reset First Format";
	initData.version = "1.0";
	initData.copyright = "(c) 2017 Leo Davidson";
	initData.url = "https://resource.dopus.com/t/unknown-format-for-folders-not-loaded-at-startup/25738";
	initData.desc = "Fix folder formats in delay-loaded tabs";
	initData.default_enable = true;
	initData.min_version = "12.0";
}

function OnOpenTab(openTabData)
{
	openTabData.Tab.Vars.Set("FolderNotLoaded", true);
}

function OnAfterFolderChange(afterFolderChangeData)
{
	if (!afterFolderChangeData.result || !afterFolderChangeData.Tab.Vars.Exists("FolderNotLoaded"))
	{
		return;
	}

	afterFolderChangeData.Tab.Vars.Delete("FolderNotLoaded");

	if (afterFolderChangeData.action == "refresh")
	{
		var cmd = DOpus.Create().Command();
		cmd.SetSourceTab(afterFolderChangeData.tab);
		cmd.RunCommand("Set FORMAT=!folder");
	}
}