item.Labels()
seems to only return explicitly assigned labels.
Button as XML
<?xml version="1.0"?>
<button backcol="none" display="both" label_pos="right" textcol="none">
<label>Demo Labels()</label>
<icon1>#newcommand</icon1>
<function type="script">
<instruction>@script JScript</instruction>
<instruction>function OnClick(clickData) {</instruction>
<instruction> var cmd = clickData.func.command;</instruction>
<instruction> var tab = clickData.func.sourcetab;</instruction>
<instruction />
<instruction> DOpus.ClearOutput();</instruction>
<instruction />
<instruction> for (var e = new Enumerator(tab.selected_files); !e.atEnd(); e.moveNext()) {</instruction>
<instruction> var item = e.item();</instruction>
<instruction> DOpus.Output(item);</instruction>
<instruction />
<instruction> for (var ee = new Enumerator(item.Labels()); !ee.atEnd(); ee.moveNext()) {</instruction>
<instruction> DOpus.Output('\t' + ee.item());</instruction>
<instruction> }</instruction>
<instruction> }</instruction>
<instruction>}</instruction>
</function>
</button>