Is it, or would it be possible to paste from the clipboard to a file with LF (\n) line endings instead of CRLFs (\r\n)? I'm able to set the file encoding, but not the line endings, which would be useful for files that get transferred to my VPS / USB stick for my Linux machine. It's mostly annoying when viewing the files in the terminal where the last line of the file and the prompt can be concatenated.
Thanks!
- Directory Opus v12.23.4 Beta x64 Build 7769
- Windows 10 v20H2 OS Build 19042.906
By the way, I'm not sure if you're aware but certain links in the local 127.0.0.1 Help don't work: The "Scripting" link points to javascript:TL_576857.HHClick() which only does anything on the online version of the help. I've not come across other instances, but they may be present.
This is what I came up with if anyone is interested:
// Convert CRLFs to LFs and encode as UTF-8 (without BOM)
function OnClick(clickData) {
if (DOpus.GetClipFormat == '') {
var paste_type = 'Image';
}
if (DOpus.GetClipFormat == 'text') {
var paste_type = 'Text';
var clip = DOpus.GetClip('text');
var regex_pattern = /\r\n/gi;
var lf_clip = clip.replace(regex_pattern,'\n');
DOpus.SetClip(lf_clip);
}
var cmd = clickData.func.command;
cmd.RunCommand('clipboard paste=enc:utf8nobom as=ask:{date|yyyyMMdd}_Clipboard_' + paste_type);
}