[Script] TimeSync 1.1 Beta2 - January 8, 2015

Discuss and share scripts and script files...
lukescammell
Posts: 744
Joined: 28 Jul 2006 13:15
Location: Kent, UK
Contact:

Re: [Script] TimeSync 1.1 Beta2 - January 8, 2015

Post by lukescammell »

You got my hopes up there Eternal, alas XnView doesn't write DNG, only read :/ Not even their pay-for XnViewMP.

I'm glad that my little diversion has helped improve your script though (through others' expertise) :)
Used to update to the latest beta every day. Now I have children instead…
Windows 10 Pro x64 (everywhere except phone…)

lukescammell
Posts: 744
Joined: 28 Jul 2006 13:15
Location: Kent, UK
Contact:

Re: [Script] TimeSync 1.1 Beta2 - January 8, 2015

Post by lukescammell »

Actually I have a feature request, if you would be so kind:

Copy and paste timestamps.

It would work something like this; select a file, activate the script (however you choose), be presented with a popup menu have two new options "Copy timestamp" and "Paste timestamp (v)".

Both of those two options would have the following suboptions:

Copy/paste timestamp:
  1. everything
  2. created
  3. modified
  4. accessed
This would give you an awful lot of flexibility when you find yourself having to make lots of little changes between lots of files, and not changing entire swathes of files. With a keybaord shortcutsetup to activate the script, you could then do something like this to cope the modified date from one file and apply it to another, entirely without touching the mouse:
  1. select a file in the list view
  2. Shift+D – activate the script and popup the menu
  3. c – activate the copy menu
  4. e – copy all of the selected file's date metadata and hide the script menu
  5. select the file you want to change the date on
  6. Shift+D – activate the script and popup the menu
  7. v – activate the paste menu
  8. e – copy all of the selected file's date metadata and hide the script menu
This would be a massively quicker way that doing it through the properties panel currently – three separarte copy and paste procedures, changing file 6 times and hitting enter after each paste and I believe you pretty much have to use the mopuse to accomplish this.

I'd also find this useful occasionally when I'm referring someone to a particular file and mentioning the modified date (it comes up, what can I say). Just beaing able to Shift+D, c, m and the Ctrl+V in Skype would be a real boon.
Used to update to the latest beta every day. Now I have children instead…
Windows 10 Pro x64 (everywhere except phone…)

lukescammell
Posts: 744
Joined: 28 Jul 2006 13:15
Location: Kent, UK
Contact:

Re: [Script] TimeSync 1.1 Beta2 - January 8, 2015

Post by lukescammell »

Wow Don. Looks like you just gave us all the tools required for my little ditty above! http://www.xyplorer.com/release_15.00.htm see the "Timestamping" section.

Thank you so much, this is amazing.

(so is the quick select btw, these two changes are massive for me, so again thanks :appl: )
Used to update to the latest beta every day. Now I have children instead…
Windows 10 Pro x64 (everywhere except phone…)

lukescammell
Posts: 744
Joined: 28 Jul 2006 13:15
Location: Kent, UK
Contact:

Re: [Script] TimeSync 1.1 Beta2 - January 8, 2015

Post by lukescammell »

[Split]
admin wrote:Hmm, "Quick Select", that would have probably a better name than "Flat Select"... :eh:
Haha, whoops, sorry, that's how I read it.

I'm struggling with the syntax of the new timestamp scripting and I can't find a full explanation of the various options – I'm obviously looking in the wrong place. Please could you point me in the right direction? I'm trying to figure out how to copy various timestamps into the clipboard.

Thanks :tup:
Used to update to the latest beta every day. Now I have children instead…
Windows 10 Pro x64 (everywhere except phone…)

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: [Script] TimeSync 1.1 Beta2 - January 8, 2015

Post by TheQwerty »

// back on-topic...
lukescammell wrote:Haha, whoops, sorry, that's how I read it.

I'm struggling with the syntax of the new timestamp scripting and I can't find a full explanation of the various options – I'm obviously looking in the wrong place. Please could you point me in the right direction? I'm trying to figure out how to copy various timestamps into the clipboard.

Thanks :tup:
Give these a try:

Code: Select all

"Copy Selected Items' Time(s) : copySelTime"
  Global $G_ITEMS = Get('SelectedItemsPathNames', '|');
  Sub '_copyTime';


"Copy Focus Item's Time(s) : copyFocTime"
  Global $G_ITEMS = <focitem>;
  Sub '_copyTime';


"-" //--------------------------------------------------------------------------


"Paste Copied Time(s) : pasteTime"
  // Prompt user to select time to paste (just assuming clipboard has valid times).
  //  4 = Show empty list.
  // 32 = Select first item.
  // 64 = Focus filter.
  $time = InputSelect('Select time to paste', <clipboard>, <crlf>, 4+32+64);
  End $time == '', 'No time selected.';

  // Prompt user to select fields to modify.
  Global $G_FIELDS;
  Sub '_fieldPrompt';
  End $G_FIELDS == '', 'No fields selected.';

  TimeStamp $type, $time;


"Paste Copied Item's Time : pasteItemTime"
  // Prompt user to select item to use as source of times (again just assuming clipboard is items).
  //  1 = Show icons.
  //  4 = Show empty list.
  // 32 = Select first item.
  // 64 = Focus filter.
  $item = InputSelect('Select source item', <clipboard>, <crlf>, 1+4+32+64);
  End $item == '', 'No source item selected.';

  // Prompt user to select fields to modify.
  Global $G_FIELDS;
  Sub '_fieldPrompt';
  End $G_FIELDS == '', 'No fields selected.';

  TimeStamp $G_FIELDS, $item,, '*';


"- : _-" //---------------------------------------------------------------------
"- : _-" //---------------------------------------------------------------------


"Copy Item Time(s)||4 : _copyTime"
  Global $G_ITEMS;
  End $G_ITEMS == '', 'Global variable G_ITEMS cannot be empty.';

  $format = 'yyyy-mm-dd hh:nn:ss';

  // Get times.
  $list = Report("+{Created $format}|+{Modified $format}|+{Accessed $format}|", $G_ITEMS);
  // Sort and remove duplicates.
  $list = FormatList($list, 'dents', '|');
  // Prompt user to select the times to copy.
  //  2 = Show checkboxes.
  //  4 = Show empty list.
  // 16 = Allow re-ordering items.
  // 32 = Select first item.
  $list = InputSelect('Select times to copy', $list, '|', 2+4+16+32);

  End $list == '', 'Nothing selected to copy.';
  CopyText $list,, '|';


"Time Fields to Modify Prompt||4 : _fieldPrompt"
  Global $G_FIELDS = '';

  // Prompt user to select fields to modify.
  //  2 = Show checkboxes.
  //  4 = Show empty list.
  // 32 = Select first item.
  $G_FIELDS = InputSelect('Select fields to modify', '+Created|+Modified|+Accessed', '|', 2+4+32);
  // Trim to first characters, remove '|', and lower case.
  $G_FIELDS = Recase(Replace(RegexMatches($G_FIELDS, '(?:^|\|).'), '|'), 'lower');

python80
Posts: 16
Joined: 08 Jul 2022 05:49

Re: [Script] TimeSync 1.1 Beta2 - January 8, 2015

Post by python80 »

CopyPasteTimestamps
CopyPasteTimestamps
Timsetamps.png (58.07 KiB) Viewed 1056 times
I want to copy/paste timestamps between files.

1) Copy file time stamps (A.rar, C.txt, D.pdf)
2) Paste timestamps to another files (q.7z, x.wmv, z.dll)

A.rar ---> q.7z
C.txt ---> x.wmv
D.pdf ---> z.dll

Code: Select all

After copy paste operation...

File      Timestamps
-----     -------------------
A.rar     Preserved
C.txt     Preserved
D.pdf     Preserved
q.7z      A.rar's timestamps      
x.wmv     C.txt's timestamps      
z.dll     D.pdf's timestamps
Is transferring timestamps multi files at once possible?

Sorry for bad English and thanks for reading.

RalphM
Posts: 1935
Joined: 27 Jan 2005 23:38
Location: Cairns, Australia

Re: [Script] TimeSync 1.1 Beta2 - January 8, 2015

Post by RalphM »

I'm sorry but even if this was possible, how would one (obviously apart from you) keep track of the order of files selected in each pane?
Ralph :)
(OS: W11 22H2 Home x64 - XY: Current beta - Office 2019 32-bit - Display: 1920x1080 @ 125%)

highend
Posts: 13308
Joined: 06 Feb 2011 00:33

Re: [Script] TimeSync 1.1 Beta2 - January 8, 2015

Post by highend »

Code: Select all

    $sel1    = get("SelectedItemsPathNames", <crlf>, 1);
    $sel2    = get("SelectedItemsPathNames", <crlf>, 2);
    $cntSel1 = gettoken($sel1, "count", <crlf>);
    end (!$sel1 || !$sel2), "No item(s) selected in at least one pane, aborted!";
    end ( $cntSel1 != gettoken($sel2, "count", <crlf>)), "Number of selection mismatch, aborted!";

    while ($i++ < $cntSel1) { timestamp , gettoken($sel1, $i, <crlf>), gettoken($sel2, $i, <crlf>); }
One of my scripts helped you out? Please donate via Paypal

python80
Posts: 16
Joined: 08 Jul 2022 05:49

Re: [Script] TimeSync 1.1 Beta2 - January 8, 2015

Post by python80 »

@highend
It's working, thank you very much.
RalphM wrote: 06 Sep 2022 13:53 I'm sorry but even if this was possible, how would one (obviously apart from you) keep track of the order of files selected in each pane?
Thanks for your comment.

The script pastes the timestamps the way we sort the files.

If we select same files on both panes and sort files by size on the right pane (Folder2) timestamp transfer will be like this:

Code: Select all

A.rar ---> x.wmv (19.021 KB)
C.txt ---> q.wmv (7.490 KB)
D.pdf ---> z.dll (54 KB)
Sorry for bad English, I hope I was able to explain.

RalphM
Posts: 1935
Joined: 27 Jan 2005 23:38
Location: Cairns, Australia

Re: [Script] TimeSync 1.1 Beta2 - January 8, 2015

Post by RalphM »

If we are talking about selecting the "same" files in both panes then your example filenames don't show this.
I can see the use of such script to re-create file dates that were changed unwillingly (e.g. not preserved on a copy or backup) but in your example file names there seems to be no correlation whatsoever between the files the dates are copied between (different names as well as extensions).
Ralph :)
(OS: W11 22H2 Home x64 - XY: Current beta - Office 2019 32-bit - Display: 1920x1080 @ 125%)

Post Reply