Then both timestamps are copied to the clipboard with a CR ie this appears in the clipboard:
18h33m
18h33m
I want to select 2 files and then only copy the bottom timestamp to the clipboard.
I want in the sample above to have only this in the clipboard: 18h33m
How do I do that?
The reason is after I have copied the timestamp I paste it into a spreadsheet I then add a prefix to both files to show they have been processed.
A bit involved to explain more fully than that I can do if anyone wants.
Back to the problem.
Somehow I need to get rid of all the lines in the clipboard accept the last line.
If I could think up a very fancy regex that filters out all but the last timestamp?
I am not sure of the mechanics of the COPYNAME switch - does that make the command act once on ever selected file?
Not sure hope to tackle with internal commands.
Would it be necessary to use a script?
Any views muchly appreciated....
@lxp - Very very helpful and fascinating to boot.
I have been meaning to start using Java as recommended by you some time ago.
This is the first time I am doing so.
Your script works but I have discovered there is a problem if there are spaces in the filename.
Script works for these 2 sample files:
I am focused in on exactly how the REGEXP switch operates currently
I wonder if I am understanding things correctly - that is the script is working fine?
I manually created this internal command string:
Making this change to the script did not work as expected.
The quotes keyword has been added: var cmdLine = 'Clipboard COPYNAMES=quotes FILE=' + tab.selected_files(i - 1) + ' REGEXP (.*)(\\d\\dh\\d\\dm)(.*) \\2';
Again I take a step back and run this internal command: Clipboard COPYNAMES=quotes
The result in the clipboard is the filename of the 2 files I had selected at execution time:
If you plan to expand the script to do more, I'd recommend using properties such as item.name and some JScript string manipulation and setting the clipboard content with DOpus.SetClip() instead of relying on the internal command Clipboard COPYNAMES.
The script will be easier to write and test and to adapt and reuse later.
Maybe share more on the final goal you want to achieve.
@lxp this is wonderful help thank you.
Odd that works for you not me - maybe Opus version or windows bug or something.
No matter I will make it work with quotes with thanks to @Leo.
This is my first JScript and that is long overdue.
Will lookup and make use of Java properties also.
Thank you once again