Is there currently any way (not to write to a temp file, then read it) to capture a program's output by forcing it to write to the clipboard (e.g. via clip
) and using DivertClipboard()
to redirect the result into a variable instead? I was hoping something like this would work, but it seems that DivertClipboard()
only affects internal DO commands.
function GetValue(item) {
var value = '';
try {
var cmdline = '"some_program.exe" "' + item + '" | clip';
var cmd = DOpus.Create().Command();
cmd.SetType('msdos');
cmd.DivertClipboard('myvar');
DOpus.Output(cmdline);
cmd.AddLine('@runmode:hide');
cmd.AddLine(cmdline);
cmd.Run();
if (DOpus.vars.Exists('myvar')) value = DOpus.vars.Get('myvar');
}
catch (err) {
DOpus.Output('Unable to get value ' : + err.description);
}
return value;
}
DOpus.Output(GetValue('D:\\test\\item.txt'));
Would it be possible for Command.DivertClipboard()
to :
- Make it work when running another program through DO that writes to the clipboard.
Or
- Find a way to capture the stdout of another program to the clipboard using an internal DO command, allowing
DivertClipboard()
to take effect?