I am try to set a hotkey command which renames the selected file by maintaining the existing name but adding new name elements into the filename and then set on inline editing with the cursor at a specific position so that I can further manually add filename elements to the final outcome.
Here's what I have so far (hotkey is already set):
rename CASE=lower
rename PRESET="Invoices and Payments Files"
Is there a command I can additionally set so that after these first two commands are run, the file is put into inline renam mode with the cursor at a specific position other than "home" or "end"?
Yes. The idea is to keep the existing filename, insert a predefined template of filename text at the beginning, and move the cursor to the 26th letter-position so that I can easily manually enter more filename components.
Thanks Leo but I'm aware of that argument and it's not what I need because I want the cursor to land in a certain spot within the new filename template, not at the end of the stem, nor the beginning. Possible?
// 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>
Hi again, everyone. Sorry, but I've just realised there's a small problem with the script and if you can help me it will be greatly appreciated.
The line: cmd.RunCommand('Rename CASE=lower');
Although it runs before the Rename PRESET, when the PRESET line runs, the CASE=lower change to the existing filename is lost. Everything else works perfectly but then I need to manually change the segment of the filename which was supposed to have been made lowercase.
Thanks for replying, Ixp. I've tried swapping them but that has not worked. As for merging, can you show me the code for that? I'm not too good at this stuff. Sorry.