It's easier to wrap the Copy command into some JScript, like so:
// https://resource.dopus.com/t/time-taken-to-complete-file-copy/41359
function OnClick(clickData) {
var cmd = clickData.func.command;
cmd.deselect = false;
cmd.RunCommand('Set UTILITY=otherlog');
DOpus.ClearOutput();
var scriptStartTime = DOpus.Create().Date();
DOpus.Output('Start: ' + scriptStartTime.Format('D#yyyy-MM-dd T#HH.mm.ss'));
cmd.RunCommand('Copy'); // modify as needed
var scriptEndTime = DOpus.Create().Date();
DOpus.Output('End: ' + scriptEndTime.Format('D#yyyy-MM-dd T#HH.mm.ss'));
var duration = (scriptEndTime - scriptStartTime) / 1000;
DOpus.Output('Duration: ' + duration + ' seconds');
}
Button as XML
<?xml version="1.0"?>
<button backcol="none" display="both" label_pos="right" textcol="none">
<label>41359</label>
<icon1>#newcommand</icon1>
<function type="script">
<instruction>@script JScript</instruction>
<instruction>// https://resource.dopus.com/t/time-taken-to-complete-file-copy/41359</instruction>
<instruction />
<instruction>function OnClick(clickData) {</instruction>
<instruction> var cmd = clickData.func.command;</instruction>
<instruction> cmd.deselect = false;</instruction>
<instruction> cmd.RunCommand('Set UTILITY=otherlog');</instruction>
<instruction />
<instruction> DOpus.ClearOutput();</instruction>
<instruction />
<instruction> var scriptStartTime = DOpus.Create().Date();</instruction>
<instruction> DOpus.Output('Start: ' + scriptStartTime.Format('D#yyyy-MM-dd T#HH.mm.ss'));</instruction>
<instruction />
<instruction> cmd.RunCommand('Copy'); // modify as needed</instruction>
<instruction />
<instruction> var scriptEndTime = DOpus.Create().Date();</instruction>
<instruction> DOpus.Output('End: ' + scriptEndTime.Format('D#yyyy-MM-dd T#HH.mm.ss'));</instruction>
<instruction />
<instruction> var duration = (scriptEndTime - scriptStartTime) / 1000;</instruction>
<instruction> DOpus.Output('Duration: ' + duration + ' seconds');</instruction>
<instruction>}</instruction>
</function>
</button>