Here's a demo script column that grabs info from the first audio file it finds in the folder.
function OnInit(initData) {
initData.name = 'AudioFolderInfo';
initData.version = '2023-10-17';
initData.copyright = '';
initData.url = 'https://resource.dopus.com/t/how-to-get-folder-columns-to-populate-info/46473';
initData.desc = '';
initData.default_enable = true;
initData.min_version = '12.0';
}
function OnAddColumns(addColData) {
var col = addColData.AddColumn();
col.name = 'AudioFolderInfo';
col.method = 'OnColumn';
}
var fsu = DOpus.FSUtil();
function OnColumn(scriptColData) {
scriptColData.value = '';
var item = scriptColData.item;
if (!item.is_dir) return;
var folderEnum = fsu.ReadDir(item); // non-recursive
while (!folderEnum.complete) {
var folderItem = folderEnum.Next();
if (folderItem.metadata == 'audio') {
// scriptColData.value = folderItem.metadata.audio.mp3albumartist;
// scriptColData.value = folderItem.metadata.audio.mp3year;
scriptColData.value = folderItem.metadata.audio.mp3artist;
break;
}
}
folderEnum.Close();
}
Save ColumnAudioFolderInfo.js.txt to
%appdata%\GPSoftware\Directory Opus\Script AddIns
Toggle the column with
Set COLUMNSTOGGLE="scp:AudioFolderInfo/AudioFolderInfo(!,a,0)"