This seems to work.
// https://resource.dopus.com/t/rename-selected-file-preserve-activate-inline-rename-at-specific-position/41349
function OnClick(clickData) {
var cmd = clickData.func.command;
var wsh = new ActiveXObject('WScript.Shell');
cmd.deselect = false;
cmd.RunCommand('Rename CASE=lower');
cmd.RunCommand('Rename PRESET="Invoices and Payments Files"');
cmd.RunCommand('Rename INLINE=home');
// In case there are timing problems
// DOpus.Delay(1000);
for (var i = 0; i < 26; ++i) {
wsh.SendKeys('{RIGHT}');
}
}
Button as XML
<?xml version="1.0"?>
<button backcol="none" display="both" label_pos="right" textcol="none">
<label>41349</label>
<icon1>#newcommand</icon1>
<function type="script">
<instruction>@script JScript</instruction>
<instruction>// https://resource.dopus.com/t/rename-selected-file-preserve-activate-inline-rename-at-specific-position/41349</instruction>
<instruction />
<instruction>function OnClick(clickData) {</instruction>
<instruction> var cmd = clickData.func.command;</instruction>
<instruction> var wsh = new ActiveXObject('WScript.Shell');</instruction>
<instruction> cmd.deselect = false;</instruction>
<instruction />
<instruction> cmd.RunCommand('Rename CASE=lower');</instruction>
<instruction> cmd.RunCommand('Rename PRESET="Invoices and Payments Files"');</instruction>
<instruction> cmd.RunCommand('Rename INLINE=home');</instruction>
<instruction />
<instruction> // In case there are timing problems</instruction>
<instruction> // DOpus.Delay(1000);</instruction>
<instruction />
<instruction> for (var i = 0; i < 26; ++i) {</instruction>
<instruction> wsh.SendKeys('{RIGHT}');</instruction>
<instruction> }</instruction>
<instruction>}</instruction>
</function>
</button>