Button Error Handling

Hello,

I am trying to create a button that:

SetAttr META Subject:C
SetAttr META tags:C

Some files would update both, some may encounter error because they are missing one of these Attr. Could someone advise me on how I can ignore error and just update whatever field is available?

If there's only one file (or all files are the same type):

SetAttr META tags:C Subject:C

For multiple files/types, a small script can be used to run the same thing on each file independently, without them affecting each other if they can't all store the same data:

  • Type = Script Function
  • Script Type = JScript
function OnClick(clickData)
{
	var cmd = clickData.func.command;
	cmd.deselect = false;

	for (var eSel = new Enumerator(clickData.func.sourcetab.selected); !eSel.atEnd(); eSel.moveNext())
	{
		cmd.ClearFiles();
		cmd.AddFile(eSel.item());
		cmd.RunCommand("SetAttr META tags:F subject:F");
	}

}
1 Like

Perfect. I work on one file at a time, and your solution worked. Thank you!

1 Like