Try
// https://resource.dopus.com/t/renaming-a-file-by-specifying-a-name/49356
function OnClick(clickData) {
var cmd = clickData.func.command;
var tab = clickData.func.sourcetab;
cmd.deselect = false;
cmd.Clear();
cmd.AddLine('Rename FROM="' + tab.all(1) + '" TO=Y002');
cmd.AddLine('Rename FROM="' + tab.all(4) + '" TO=R005');
cmd.AddLine('Rename FROM="' + tab.all(5) + '" TO=Z006');
cmd.AddLine('Rename FROM="' + tab.all(6) + '" TO=L007');
cmd.AddLine('Rename FROM="' + tab.all(7) + '" TO=H008');
cmd.AddLine('Rename FROM="' + tab.all(9) + '" TO=F010');
cmd.AddLine('Rename FROM="' + tab.all(10) + '" TO=L011');
cmd.Run();
}
XML
<?xml version="1.0"?>
<button backcol="none" display="label" textcol="none">
<label>49356</label>
<icon1>#newcommand</icon1>
<function type="script">
<instruction>@script JScript</instruction>
<instruction>// https://resource.dopus.com/t/renaming-a-file-by-specifying-a-name/49356</instruction>
<instruction />
<instruction>function OnClick(clickData) {</instruction>
<instruction> var cmd = clickData.func.command;</instruction>
<instruction> var tab = clickData.func.sourcetab;</instruction>
<instruction />
<instruction> cmd.deselect = false;</instruction>
<instruction />
<instruction> cmd.Clear();</instruction>
<instruction> cmd.AddLine('Rename FROM="' + tab.all(1) + '" TO=Y002');</instruction>
<instruction> cmd.AddLine('Rename FROM="' + tab.all(4) + '" TO=R005');</instruction>
<instruction> cmd.AddLine('Rename FROM="' + tab.all(5) + '" TO=Z006');</instruction>
<instruction> cmd.AddLine('Rename FROM="' + tab.all(6) + '" TO=L007');</instruction>
<instruction> cmd.AddLine('Rename FROM="' + tab.all(7) + '" TO=H008');</instruction>
<instruction> cmd.AddLine('Rename FROM="' + tab.all(9) + '" TO=F010');</instruction>
<instruction> cmd.AddLine('Rename FROM="' + tab.all(10) + '" TO=L011');</instruction>
<instruction> cmd.Run();</instruction>
<instruction>}</instruction>
</function>
</button>