Page 1 of 2

Request to add a variable with date and time in Total Commander 11

Posted: 2023-05-12, 12:51 UTC
by PiotrMPPL
Hi

Request to add a variable with date and time in Total Commander 11

ex. YYYYMMDDhhmmss

Re: Request to add a variable with date and time in Total Commander 11

Posted: 2023-05-12, 13:17 UTC
by Stefan2
  
2PiotrMPPL

Where would you use that? And how?


There is already


a) For Shift+F4 and F7 there are this templates: <[YMD] <[hms] behind the button on the right.


b) The WDX content plugin "filesys" (filesys sample plugin v2.5 from 31.Jan.2019)
adds new fields "Today" and "Yesterday" give back a Boolean "Yes" or "No"
[=filesys.Today]
[=filesys.Yesterday]

This works fine for Search for files created "Today" and "Yesterday",
and so for "Color by filetype" files created "Today" and "Yesterday" too.


c) For MRT, to add the current date&time, we can use [T3]:
[N]-backup created at [T3] [YMD] - [hms]





d) Left over the TC command line and the button parameter box.

03.05.23 Release Total Commander 11.00 beta 1
26.04.23 Added: Command line parameters (button bar, start menu): New parameter %|envvar|
inserts environment variable envvar, e.g. %|windir| or %|$DESKTOP| in the parameter field (32/64)

So I have something to play around this weekend ;.)
and to test if %|date| and %|time| or %|myOwnTimestamp| will work.

Could be need/neat for a simple command line usage w/o the need for external batch/script:
7z.exe -x "%P" -o "backup of %N - %|myOwnTimestamp|.7z"


 

Re: Request to add a variable with date and time in Total Commander 11

Posted: 2023-05-12, 13:22 UTC
by PiotrMPPL
Why can't you add the TC timestamp yyyymmddhhmmss and not use the script?

Re: Request to add a variable with date and time in Total Commander 11

Posted: 2023-05-12, 13:50 UTC
by Dalai
Can you name an example (or multiple) of where in TC such variable is missing? As Stefan2 already pointed out that the MRT, Shift+F4 and F7 dialogs can use such variables.

Regards
Dalai

Re: Request to add a variable with date and time in Total Commander 11

Posted: 2023-05-12, 15:02 UTC
by PiotrMPPL
But not for the button

Re: Request to add a variable with date and time in Total Commander 11

Posted: 2023-05-12, 15:59 UTC
by Dalai
It would be much easier if you said what you mean in a more complete way.

Anyway, puzzling together the little pieces of information given, I guess what you want is another pre-defined placeholder [YMDhms] that combines the already existing seperate placeholders [YMD] and [hms]. If that's true, I can say that once you used the existing [YMD][hms] that string will be in the history of the specific dialog (MRT, Shift+F4 and F7 all save their history independently). OTOH I think that it could be beneficial to have another combined placeholder. Still it would be required to know WHERE you miss this placeholder.

Regards
Dalai

Re: Request to add a variable with date and time in Total Commander 11

Posted: 2023-05-12, 16:45 UTC
by Gral
As I am guessing it's to be used as a parameter in buttons, user commands and start menu similar to system %DATE% %TIME% variables.
I can even guess further - e.g. to create archive names from the command line with the current date.

Re: Request to add a variable with date and time in Total Commander 11

Posted: 2023-05-12, 17:16 UTC
by tuska
Example for the use of a button.
  1. Multi-Rename Tool... Ctrl+M
    1. Rename mask: file name: [YMDhms]_[N]
    2. Save settings: YYYYMMDDhhmmss
  2. Button with command ... "MULTIRENAME==YYYYMMDDhhmmss" | test.txt --> 20230512191432_test.txt
    Help - F1: Search for -> MULTIRENAME -> double-click on: Dialog box: Configuration: Change button bar > Command ... 12.

    Code: Select all

    TOTALCMD#BAR#DATA
    MULTIRENAME==YYYYMMDDhhmmss
    
    wciconex.dll,5
    MULTIRENAME==YYYYMMDDhhmmss|Multi-Rename Tool... Ctrl+M || Rename mask: file name: [YMDhms]_[N]|https://www.ghisler.ch/board/viewtopic.php?t=78993|Renaming starts immediately and the multi-rename tool will close if there were no errors.|Undo is possible.
    
    
    -1
    
  3. Create a Button in the Buttonbar (copy/paste CODE)
    1. Click on "SELECT ALL" (to the right of CODE:), then press CTRL+C (copy to clipboard).
    2. Right-click on any place in the button bar, then click on "Paste".
       ⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺
    3. Option1: Point to the new button (slightly longer): 'Tooltip' is shown (-> description to the button).
                    A maximum of 259 characters is allowed for the tooltip. | = create line break, || = create | as separator character.
    4. Option2: Button bar - "Tooltip" field: A single space deactivates the display of the tooltip.
                    If the "Tooltip" field is empty, the content of the "Command" field is displayed.
    5. Option3: See FAQs and explanation: Button-code (TOTALCMD#BAR#DATA)  <-- <Ctrl+click on the link...>

Re: Request to add a variable with date and time in Total Commander 11

Posted: 2023-05-13, 04:00 UTC
by Fla$her
PiotrMPPL wrote: 2023-05-12, 13:22 UTCWhy can't you add the TC timestamp yyyymmddhhmmss and not use the script?
What do you mean by scripts? Parameters to %ComSpec% or nircmd are scripts in your opinion?

Stefan2 wrote: 2023-05-12, 13:17 UTC So I have something to play around this weekend ;.)
and to test if %|date| and %|time| or %|myOwnTimestamp| will work.
Of course, they won't work. Don't waste your time. When requesting such syntax, I meant only EnVars.
Gral wrote: 2023-05-12, 16:45 UTCAs I am guessing it's to be used as a parameter in buttons, user commands and start menu similar to system %DATE% %TIME% variables.
I don't even doubt that it's about that. Only there are no such system environment variables, these variables relate exclusively to cmd.exe.
And the most basic problem will be the naming of such parameters. %Y, %y, %M, %D, %d, %S, %s are occupied. Only %h and %m remain. But it would be possible to double the letters: %YY, %MM, %DD, etc.
Gral wrote: 2023-05-12, 16:45 UTCI can even guess further - e.g. to create archive names from the command line with the current date.
Including. WinRAR, by the way, has a built-in parameter.

Re: Request to add a variable with date and time in Total Commander 11

Posted: 2023-05-16, 17:27 UTC
by hi5
My proposal %K ("Kurrent time?") YYYYMMDDHH24MISS with substring fields and additional options
Date/time as new Parameters for Button bar, user cmd
https://www.ghisler.ch/board/viewtopic.php?t=75669

Re: Request to add a variable with date and time in Total Commander 11

Posted: 2023-05-16, 18:03 UTC
by beb
Support this.
With the adjustable/flexible syntax (e.g., if I steal the %K from the above u/hi5 post):
%K "{yyyyMMddTHHmm}"
%K "{yyyyMMddTHHmmssfff}"
%K "{yyyy-MM-dd HH:mm:ss.ffff}"

Code: Select all

# Get-Date (formats)
# https://learn.microsoft.com/en-ca/powershell/module/Microsoft.PowerShell.Utility/Get-Date
# yyyyMMddTHHmmssffff
# yyyy  4-digit year
# MM    2-digit month
# dd    2-digit day
# T     letter T as a [common] time separator [if needed]
# HH    2-digit hour
# mm    2-digit minute
# ss    2-digit second
# ffff  4-digit millisecond (f, ff, fff for 1/10, 1/100, and millisecond respectively, etc.)

Re: Request to add a variable with date and time in Total Commander 11

Posted: 2023-05-17, 16:01 UTC
by ghisler(Author)
I have chosen a different approach: In beta 3, have added a new pseudo environment variable %$DATE% which inserts the current date in the form YYYYMMDDhhmmss. It also supports the same placeholders as the multi-rename tool, e.g.
%$DATE:YMDhms% and also the 12 hour format variations H and i, and 2 digit years y.
In addition to that, it allows any separators like dots or dashes. In the parameters field you can use e.g.
?%|$DATE:Y-M-D h.m.s|
It also supports partial strings like other environment variables with the ~ syntax.

Re: Request to add a variable with date and time in Total Commander 11

Posted: 2023-05-17, 16:42 UTC
by beb
2ghisler(Author) that's entirely meets expectations. Thank you very much!

Re: Request to add a variable with date and time in Total Commander 11

Posted: 2023-05-17, 18:57 UTC
by hi5
Thanks!

Re: Request to add a variable with date and time in Total Commander 11

Posted: 2023-05-17, 19:08 UTC
by funkymonk
Looks good in TC11.00b3.

It would look even better if %$DATE% could be used in the pack files dialog to add the current date to the zip filename... (suggestion)